@@ -86,7 +86,7 @@ def find_arduino_files():
86
86
class Changed :
87
87
file : str
88
88
hunk : list [str ]
89
- lines : list [str ]
89
+ lines : list [int ]
90
90
91
91
92
92
@dataclass
@@ -122,7 +122,9 @@ def reset_with_line(ctx, line):
122
122
123
123
def pop (out , context , line ):
124
124
if ctx .file and ctx .hunk and ctx .markers :
125
- out .append (Changed (ctx .file , "\n " .join (ctx .hunk ), ", " .join (ctx .markers )))
125
+ out .append (
126
+ Changed (file = ctx .file , hunk = "\n " .join (ctx .hunk ), lines = ctx .markers )
127
+ )
126
128
127
129
reset_with_line (context , line )
128
130
@@ -157,7 +159,7 @@ def pop(out, context, line):
157
159
numbers = numbers .replace ("+" , "" )
158
160
numbers = numbers .replace ("-" , "" )
159
161
160
- ctx .markers .append (numbers )
162
+ ctx .markers .append (int ( numbers ) )
161
163
ctx .append_hunk = True
162
164
163
165
# capture diff for the summary
@@ -169,10 +171,12 @@ def pop(out, context, line):
169
171
return out
170
172
171
173
172
- def warning_changed (changed : Changed ):
173
- print (
174
- f"::warning file={ changed .file } ,title=Run tests/restyle.sh and re-commit { changed .file } ::File { changed .file } failed clang-format style check. (lines { changed .lines } )"
175
- )
174
+ def errors_changed (changed : Changed ):
175
+ all_lines = ", " .join (str (x ) for x in changed .lines )
176
+ for line in changed .lines :
177
+ print (
178
+ f"::error file={ changed .file } ,title=Run tests/restyle.sh and re-commit { changed .file } ,line={ line } ::File { changed .file } failed clang-format style check. (lines { all_lines } )"
179
+ )
176
180
177
181
178
182
SUMMARY_PATH = pathlib .Path (os .environ .get ("GITHUB_STEP_SUMMARY" , os .devnull ))
@@ -214,8 +218,8 @@ def run_format(args):
214
218
215
219
def run_assert (args ):
216
220
for changed in changed_files ():
217
- if args .with_warnings :
218
- warning_changed (changed )
221
+ if args .with_errors :
222
+ errors_changed (changed )
219
223
if args .with_summary :
220
224
summary_diff (changed )
221
225
@@ -246,7 +250,7 @@ def run_assert(args):
246
250
assert_ = cmd .add_parser ("assert" )
247
251
assert_ .set_defaults (func = run_assert )
248
252
assert_ .add_argument ("--with-summary" , action = "store_true" )
249
- assert_ .add_argument ("--with-warnings " , action = "store_true" )
253
+ assert_ .add_argument ("--with-errors " , action = "store_true" )
250
254
251
255
args = parser .parse_args ()
252
256
args .func (args )
0 commit comments