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 <pieter.degendt@basalte.be>
This commit is contained in:
parent
1ffd746e40
commit
2c496c094b
1 changed files with 2 additions and 2 deletions
|
@ -303,8 +303,8 @@ class ClangFormatCheck(ComplianceTest):
|
|||
for patch in patchset:
|
||||
for hunk in patch:
|
||||
# Strip the before and after context
|
||||
before = next(i for i,v in enumerate(hunk) if str(v).startswith('-'))
|
||||
after = next(i for i,v in enumerate(reversed(hunk)) if str(v).startswith('+'))
|
||||
before = next(i for i,v in enumerate(hunk) if str(v).startswith(('-', '+')))
|
||||
after = next(i for i,v in enumerate(reversed(hunk)) if str(v).startswith(('-', '+')))
|
||||
msg = "".join([str(l) for l in hunk[before:-after or None]])
|
||||
|
||||
# show the hunk at the last line
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue