aboutsummaryrefslogtreecommitdiff
path: root/test/lint
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-04-28 12:40:22 +0100
committerfanquake <fanquake@gmail.com>2022-04-28 12:40:36 +0100
commite36c612e5a9bd811ceab5ecaa9686403d7e94fe0 (patch)
treebdd554f32d6d572f56e58e456547c560120068f7 /test/lint
parent85aea18ae660b5edf7b6c1415f033cfcb15307f9 (diff)
parentfa82a1ed833fd749849fa19267207b63e338d84d (diff)
downloadbitcoin-e36c612e5a9bd811ceab5ecaa9686403d7e94fe0.tar.xz
Merge bitcoin/bitcoin#24988: lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py
fa82a1ed833fd749849fa19267207b63e338d84d lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py (MacroFake) Pull request description: Follow up to commit b1c5991eebb916755be188f355ad36fe01a3f529. Also remove empty newline added in that commit. ACKs for top commit: fanquake: ACK fa82a1ed833fd749849fa19267207b63e338d84d Tree-SHA512: cf398eceb135672137183bfa19ee57a82553a3dbcbce74db954c6fcd79f9606092cc0d8217610fe6cd67b7ef2d4f01d90329f0f568516d9b14aa2cd0f0715478
Diffstat (limited to 'test/lint')
-rwxr-xr-xtest/lint/lint-assertions.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/lint/lint-assertions.py b/test/lint/lint-assertions.py
index a8d2b3927c..195ff33d11 100755
--- a/test/lint/lint-assertions.py
+++ b/test/lint/lint-assertions.py
@@ -30,20 +30,20 @@ def main():
r"[^_]assert\(.*(\+\+|\-\-|[^=!<>]=[^=!<>]).*\);",
"--",
"*.cpp",
- "*.h"
+ "*.h",
], "Assertions should not have side effects:")
- # Macro CHECK_NONFATAL(condition) should be used instead of assert for RPC code, where it
- # is undesirable to crash the whole program. See: src/util/check.h
+ # Aborting the whole process is undesirable for RPC code. So nonfatal
+ # checks should be used over assert. See: src/util/check.h
# src/rpc/server.cpp is excluded from this check since it's mostly meta-code.
exit_code |= git_grep([
"-nE",
- r"\<(A|a)ssert *\(.*\);",
+ r"\<(A|a)ss(ume|ert) *\(.*\);",
"--",
"src/rpc/",
"src/wallet/rpc*",
- ":(exclude)src/rpc/server.cpp"
- ], "CHECK_NONFATAL(condition) should be used instead of assert for RPC code.")
+ ":(exclude)src/rpc/server.cpp",
+ ], "CHECK_NONFATAL(condition) or NONFATAL_UNREACHABLE should be used instead of assert for RPC code.")
sys.exit(exit_code)