Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 3c2bac8

Browse files
fix: file fix for lines with just a pren (#431)
* fix: file fix for lines with just a pren * fix: lint * fix: black * fix: paren to parenthesis
1 parent e4b6e1c commit 3c2bac8

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

codecov_cli/services/upload/upload_collector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def _produce_file_fixes(
4646
comment_regex = re.compile(r"^\s*\/\/.*$")
4747
bracket_regex = re.compile(r"^\s*[\{\}]\s*(\/\/.*)?$")
4848
list_regex = re.compile(r"^\s*[\]\[]\s*(\/\/.*)?$")
49+
parenthesis_regex = re.compile(r"^\s*[\(\)]\s*(\/\/.*)?$")
4950
go_function_regex = re.compile(r"^\s*func\s*[\{]\s*(\/\/.*)?$")
5051
php_end_bracket_regex = re.compile(r"^\s*\);\s*(\/\/.*)?$")
5152

@@ -54,7 +55,7 @@ def _produce_file_fixes(
5455
lcov_excel_regex = re.compile(r"\/\/ LCOV_EXCL")
5556

5657
kt_patterns_to_apply = fix_patterns_to_apply(
57-
[bracket_regex], [comment_block_regex], True
58+
[bracket_regex, parenthesis_regex], [comment_block_regex], True
5859
)
5960
go_patterns_to_apply = fix_patterns_to_apply(
6061
[empty_line_regex, comment_regex, bracket_regex, go_function_regex],
@@ -71,7 +72,6 @@ def _produce_file_fixes(
7172
[],
7273
False,
7374
)
74-
7575
cpp_swift_vala_patterns_to_apply = fix_patterns_to_apply(
7676
[empty_line_regex, bracket_regex],
7777
[lcov_excel_regex],

tests/data/files_to_fix_examples/sample.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ secnod line
1313
should fix previous
1414
}
1515

16+
data class Key(
17+
val key: String? = null
18+
)
1619

1720
/*
1821

tests/services/upload/test_upload_collector.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def test_fix_kt_files():
1818
assert len(fixes) == 1
1919
fixes_for_kt_file = fixes[0]
2020

21-
assert fixes_for_kt_file.eof == 30
22-
assert fixes_for_kt_file.fixed_lines_without_reason == set([1, 3, 7, 9, 12, 14])
21+
assert fixes_for_kt_file.eof == 33
22+
assert fixes_for_kt_file.fixed_lines_without_reason == set([1, 3, 7, 9, 12, 14, 18])
2323
assert fixes_for_kt_file.fixed_lines_with_reason == set(
2424
[
25-
(17, " /*\n"),
26-
(22, "*/\n"),
25+
(20, " /*\n"),
26+
(25, "*/\n"),
2727
]
2828
)
2929

0 commit comments

Comments
 (0)