Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian-Hirt committed Apr 24, 2024
1 parent 5b7d2aa commit 5a52338
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/haml_lint/ruby_extraction/chunk_extractor.rb
Expand Up @@ -692,7 +692,7 @@ def self.block_keyword(code)
return keyword
end

code.scan(Haml::Parser::BLOCK_KEYWORD_REGEX) do |c|
code.scan(Haml::Parser::BLOCK_KEYWORD_REGEX) do |_c|
# Check that the keyword is actually a keyword, and not
# an argument to a method.
next_char = code[Regexp.last_match.offset(0)[1]]
Expand All @@ -702,7 +702,7 @@ def self.block_keyword(code)
return Regexp.last_match[1] || Regexp.last_match[2]
end

return nil
nil
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions spec/haml_lint/ruby_extraction/chunk_extractor_spec.rb
Expand Up @@ -261,25 +261,25 @@ def do_test
expect(described_class.block_keyword(input_single_line)).to eq(nil)

# Keyword as symbol not first on new line should work
input_multiline_1 = <<~HAML
input_multiline1 = <<~HAML
= helper foo: true,
bar: true, if: false
HAML
expect(described_class.block_keyword(input_multiline_1)).to eq(nil)
expect(described_class.block_keyword(input_multiline1)).to eq(nil)

# Keyword as symbol first on new line should also work
input_multiline_2 = <<~HAML
input_multiline2 = <<~HAML
= helper foo: true, bar: true,
if: false
HAML
expect(described_class.block_keyword(input_multiline_2)).to eq(nil)
expect(described_class.block_keyword(input_multiline2)).to eq(nil)

# Testing with another keyword
input_multiline_3 = <<~HAML
input_multiline3 = <<~HAML
= helper foo: true, bar: true,
for: User.first
HAML
expect(described_class.block_keyword(input_multiline_3)).to eq(nil)
expect(described_class.block_keyword(input_multiline3)).to eq(nil)
end
end
end

0 comments on commit 5a52338

Please sign in to comment.