Skip to content

Commit a8881f2

Browse files
committed
🐛 Fixed bug with L4 checker
1 parent 7d8459b commit a8881f2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/coding_style/all/f4_lines_number.cr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ class LinesNumber < CodingStyle
3535

3636
content.scan(FUNCTION_DECLARATION_REGEX).each { |match|
3737
row, _ = self.get_row_column(splitted_content, match.end)
38-
indent_level = 0
38+
indent_level = 1
3939
line_count = 0
4040

4141
(row...splitted_content.size).each { |i|
42-
if splitted_content[i] =~ /{/
43-
indent_level += 1
44-
elsif splitted_content[i] =~ /}/
45-
indent_level -= 1
42+
indent_level += splitted_content[i].count("{")
43+
if splitted_content[i] =~ /}/
44+
indent_level -= splitted_content[i].count("}")
4645
if indent_level <= 0
4746
break
4847
end

0 commit comments

Comments
 (0)