Skip to content

Commit

Permalink
🐛 Fixed bug with L4 checker
Browse files Browse the repository at this point in the history
  • Loading branch information
CustomEntity committed Jun 1, 2022
1 parent 7d8459b commit a8881f2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/coding_style/all/f4_lines_number.cr
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ class LinesNumber < CodingStyle

content.scan(FUNCTION_DECLARATION_REGEX).each { |match|
row, _ = self.get_row_column(splitted_content, match.end)
indent_level = 0
indent_level = 1
line_count = 0

(row...splitted_content.size).each { |i|
if splitted_content[i] =~ /{/
indent_level += 1
elsif splitted_content[i] =~ /}/
indent_level -= 1
indent_level += splitted_content[i].count("{")
if splitted_content[i] =~ /}/
indent_level -= splitted_content[i].count("}")
if indent_level <= 0
break
end
Expand Down

0 comments on commit a8881f2

Please sign in to comment.