Class: PlatformosCheck::MissingEnableComment
- Inherits:
-
LiquidCheck
- Object
- Check
- LiquidCheck
- PlatformosCheck::MissingEnableComment
- Defined in:
- lib/platformos_check/checks/missing_enable_comment.rb
Constant Summary
Constants inherited from Check
Check::CATEGORIES, Check::SEVERITIES, Check::SEVERITY_VALUES
Instance Attribute Summary
Attributes inherited from Check
#ignored_patterns, #offenses, #options, #platformos_app
Instance Method Summary collapse
- #after_document(node) ⇒ Object
- #on_comment(node) ⇒ Object
- #on_document(_node) ⇒ Object
- #on_inline_comment(node) ⇒ Object
Methods included from ChecksTracking
Methods included from ParsingHelpers
Methods inherited from Check
#==, #add_offense, all, can_disable, #can_disable?, categories, #categories, category, #code_name, doc, #doc, docs_url, #ignore!, #ignored?, #severity, severity, #severity=, #severity_value, severity_value, single_file, #single_file?, #to_s, #whole_platformos_app?
Methods included from JsonHelpers
#format_json_parse_error, #pretty_json
Instance Method Details
#after_document(node) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/platformos_check/checks/missing_enable_comment.rb', line 24 def after_document(node) checks_missing_end_index = @disabled_checks.checks_missing_end_index return if checks_missing_end_index.empty? = if checks_missing_end_index.any? { |name| name == :all } "All checks were" else checks_missing_end_index.join(', ') + " " + (checks_missing_end_index.size == 1 ? "was" : "were") end add_offense("#{} disabled but not re-enabled with platformos-check-enable", node:) end |
#on_comment(node) ⇒ Object
16 17 18 |
# File 'lib/platformos_check/checks/missing_enable_comment.rb', line 16 def on_comment(node) @disabled_checks.update(node) end |
#on_document(_node) ⇒ Object
12 13 14 |
# File 'lib/platformos_check/checks/missing_enable_comment.rb', line 12 def on_document(_node) @disabled_checks = DisabledChecks.new end |
#on_inline_comment(node) ⇒ Object
20 21 22 |
# File 'lib/platformos_check/checks/missing_enable_comment.rb', line 20 def on_inline_comment(node) @disabled_checks.update(node) end |