Skip to content

Commit 34c11ad

Browse files
committed
fix(nolint): reverse order of if/else in previous commit
seems to be slightly more performant due to branch prediction (former is more likely)
1 parent ec42a60 commit 34c11ad

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cpplint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,11 +1157,11 @@ def ProcessCategory(category):
11571157
_error_suppressions.StartBlockSuppression(category, linenum)
11581158
elif no_lint_type == "END":
11591159
if not _error_suppressions.HasOpenBlock():
1160-
if matched.group(2) not in (None, "(*)"):
1160+
if matched.group(2) in (None, "(*)"):
1161+
error(filename, linenum, "readability/nolint", 5, "Not in a NOLINT block")
1162+
else:
11611163
# Has category; probably a clang-tidy rule. Safer to ignore.
11621164
pass
1163-
else:
1164-
error(filename, linenum, "readability/nolint", 5, "Not in a NOLINT block")
11651165

11661166
def ProcessCategory(category):
11671167
if category is not None:

0 commit comments

Comments
 (0)