Skip to content

Commit 2c496c0

Browse files
pdgendtnashif
authored andcommitted
scripts: ci: Fix clang-format compliance for additions or removals
If a diff only has added or removed lines we need to match both '-' and '+' characters in the hunk context. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 1ffd746 commit 2c496c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/ci/check_compliance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ def run(self):
303303
for patch in patchset:
304304
for hunk in patch:
305305
# Strip the before and after context
306-
before = next(i for i,v in enumerate(hunk) if str(v).startswith('-'))
307-
after = next(i for i,v in enumerate(reversed(hunk)) if str(v).startswith('+'))
306+
before = next(i for i,v in enumerate(hunk) if str(v).startswith(('-', '+')))
307+
after = next(i for i,v in enumerate(reversed(hunk)) if str(v).startswith(('-', '+')))
308308
msg = "".join([str(l) for l in hunk[before:-after or None]])
309309

310310
# show the hunk at the last line

0 commit comments

Comments
 (0)