Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0d789d2

Browse filesBrowse files
committed
Remove unused disable method
1 parent de8da1a commit 0d789d2
Copy full SHA for 0d789d2

File tree

Expand file treeCollapse file tree

2 files changed

+0
-39
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+0
-39
lines changed

‎lib/erblint-github/linters/custom_helpers.rb

Copy file name to clipboardExpand all lines: lib/erblint-github/linters/custom_helpers.rb
-18Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,6 @@ module Linters
88
module CustomHelpers
99
INTERACTIVE_ELEMENTS = %w[button summary input select textarea a].freeze
1010

11-
def rule_disabled?(processed_source)
12-
processed_source.parser.ast.descendants(:erb).each do |node|
13-
indicator_node, _, code_node, = *node
14-
indicator = indicator_node&.loc&.source
15-
comment = code_node&.loc&.source&.strip
16-
rule_name = simple_class_name
17-
18-
if indicator == "#" && comment.start_with?("erblint:disable") && comment.match(rule_name)
19-
if @offenses.any?
20-
clear_offenses
21-
else
22-
add_offense(processed_source.to_source_range(code_node.loc),
23-
"Unused erblint:disable comment for #{rule_name}")
24-
end
25-
end
26-
end
27-
end
28-
2911
def counter_correct?(processed_source)
3012
comment_node = nil
3113
expected_count = 0

‎test/custom_helpers_test.rb

Copy file name to clipboardExpand all lines: test/custom_helpers_test.rb
-21Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,6 @@ def extended_linter
2020
@linter.extend(ERBLint::Linters::CustomHelpers)
2121
end
2222

23-
def test_rule_disabled_clears_offenses_if_rule_is_disabled
24-
@file = <<~HTML
25-
<%# erblint:disable CustomHelpersTest::FakeLinter %>
26-
HTML
27-
@linter.offenses = ["fake offense"]
28-
assert_equal @linter.offenses.length, 1
29-
30-
extended_linter.rule_disabled?(processed_source)
31-
assert_empty @linter.offenses
32-
end
33-
34-
def test_rule_disabled_adds_offense_if_disable_comment_is_present_but_no_offense
35-
@file = <<~HTML
36-
<%# erblint:disable CustomHelpersTest::FakeLinter %>
37-
HTML
38-
assert_empty @linter.offenses
39-
40-
extended_linter.rule_disabled?(processed_source)
41-
assert_equal "Unused erblint:disable comment for CustomHelpersTest::FakeLinter", @linter.offenses.first.message
42-
end
43-
4423
def test_counter_correct_does_not_add_offense_if_counter_matches_offense_count
4524
@file = <<~HTML
4625
<%# erblint:counter CustomHelpersTest::FakeLinter 1 %>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.