mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-21 09:22:18 +02:00
doc: Remove confusing assert linter
This commit is contained in:
parent
f5c5ddafbc
commit
fa6e6a3f03
@ -739,12 +739,6 @@ Common misconceptions are clarified in those sections:
|
|||||||
- Passing (non-)fundamental types in the [C++ Core
|
- Passing (non-)fundamental types in the [C++ Core
|
||||||
Guideline](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-conventional).
|
Guideline](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-conventional).
|
||||||
|
|
||||||
- Assertions should not have side-effects.
|
|
||||||
|
|
||||||
- *Rationale*: Even though the source code is set to refuse to compile
|
|
||||||
with assertions disabled, having side-effects in assertions is unexpected and
|
|
||||||
makes the code harder to understand.
|
|
||||||
|
|
||||||
- If you use the `.h`, you must link the `.cpp`.
|
- If you use the `.h`, you must link the `.cpp`.
|
||||||
|
|
||||||
- *Rationale*: Include files define the interface for the code in implementation files. Including one but
|
- *Rationale*: Include files define the interface for the code in implementation files. Including one but
|
||||||
|
@ -23,20 +23,10 @@ def git_grep(params: [], error_msg: ""):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# PRE31-C (SEI CERT C Coding Standard):
|
|
||||||
# "Assertions should not contain assignments, increment, or decrement operators."
|
|
||||||
exit_code = git_grep([
|
|
||||||
"-E",
|
|
||||||
r"[^_]assert\(.*(\+\+|\-\-|[^=!<>]=[^=!<>]).*\);",
|
|
||||||
"--",
|
|
||||||
"*.cpp",
|
|
||||||
"*.h",
|
|
||||||
], "Assertions should not have side effects:")
|
|
||||||
|
|
||||||
# Aborting the whole process is undesirable for RPC code. So nonfatal
|
# Aborting the whole process is undesirable for RPC code. So nonfatal
|
||||||
# checks should be used over assert. See: src/util/check.h
|
# 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.
|
# src/rpc/server.cpp is excluded from this check since it's mostly meta-code.
|
||||||
exit_code |= git_grep([
|
exit_code = git_grep([
|
||||||
"-nE",
|
"-nE",
|
||||||
r"\<(A|a)ss(ume|ert) *\(.*\);",
|
r"\<(A|a)ss(ume|ert) *\(.*\);",
|
||||||
"--",
|
"--",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user