Skip to content

Commit 6a126c3

Browse files
authored
Appease SafeNavigationChainLength
1 parent ae6dcff commit 6a126c3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/erblint-github/linters/custom_helpers.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ def counter_correct?(processed_source)
3636
processed_source.parser.ast.descendants(:erb).each do |node|
3737
indicator_node, _, code_node, = *node
3838
indicator = indicator_node&.loc&.source
39-
comment = code_node&.loc&.source&.strip
39+
comment = code_node&.loc&.source
40+
stripped_comment = comment&.strip
4041

41-
if indicator == "#" && comment.start_with?("erblint:counter") && comment.match(rule_name)
42+
if indicator == "#" && stripped_comment.start_with?("erblint:counter") && stripped_comment.match(rule_name)
4243
comment_node = node
43-
expected_count = comment.match(/\s(\d+)\s?$/)[1].to_i
44+
expected_count = stripped_comment.match(/\s(\d+)\s?$/)[1].to_i
4445
end
4546
end
4647

0 commit comments

Comments
 (0)