@@ -58,6 +58,21 @@ def hl(text: str) -> str:
58
58
return colored (text , _COLOR_HIGHLIGHT )
59
59
60
60
61
+ def print_checkstyle_not_parseable_error ():
62
+ """
63
+ If the user has a maven problem that prevents checkstyle from running they'd likely
64
+ appreciate *some* output. If we can't extract a violation count the checkstyle plugin
65
+ probably didn't run successfully. Let's warn them.
66
+ """
67
+ print ()
68
+ print (warn ("Checkstyle output doesn't contain a violation count. Maybe your setup has an error?" ))
69
+ if len (sys .argv ) > 1 :
70
+ print (
71
+ f" { hl ('Suggestion' )} : Run this script without arguments and inspect the unfiltered "
72
+ "checkstyle output"
73
+ )
74
+
75
+
61
76
def write_checkstyle_config (path : Path ) -> None :
62
77
"""
63
78
Saves the Javadoc checkstyle config in the given path.
@@ -68,7 +83,7 @@ def write_checkstyle_config(path: Path) -> None:
68
83
<module name="Checker">
69
84
<module name="TreeWalker">
70
85
<module name="JavadocMethod">
71
- <property name="scope " value="public"/>
86
+ <property name="accessModifiers " value="public"/>
72
87
</module>
73
88
<module name="MissingJavadocMethod">
74
89
<property name="scope" value="public"/>
@@ -197,9 +212,11 @@ def handle_compare_with_branch_output(target_branch: str, reference_output: str,
197
212
198
213
if reference_violation_count is None :
199
214
print (warn ("The Checkstyle run for the reference branch did not yield any result." ))
215
+ print_checkstyle_not_parseable_error ()
200
216
exit (1 )
201
217
if other_violation_count is None :
202
218
print (warn ("The Checkstyle run for your branch did not yield any result." ))
219
+ print_checkstyle_not_parseable_error ()
203
220
exit (1 )
204
221
205
222
print_current_status (target_branch , reference_violation_count , other_violation_count )
@@ -244,17 +261,8 @@ def command_filtered_checkstyle_errors(regex_str: str) -> None:
244
261
if regex .search (line ):
245
262
print (line )
246
263
247
- # If the user has a maven problem that prevents checkstyle from running they'd likely
248
- # appreciate *some* output. If we can't extract a violation count the checkstyle plugin
249
- # probably didn't successfully. Let's warn them.
250
264
if extract_violation_count (checkstyle_output ) is None :
251
- print ()
252
- print (warn ("Checkstyle output doesn't contain a violation count. Maybe your setup has an error?" ))
253
- if len (sys .argv ) > 1 :
254
- print (
255
- f" { hl ('Suggestion' )} : Run this script without arguments and inspect the unfiltered "
256
- "checkstyle output"
257
- )
265
+ print_checkstyle_not_parseable_error ()
258
266
259
267
260
268
def fix_colors_windows_cmd ():
0 commit comments