diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-04-19 10:45:29 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-04-22 09:10:17 +0200 |
commit | 52fab72397687467650093c86e5479cb1d759042 (patch) | |
tree | 110bb149efbbd303993a6019d61fac7da6dba0c8 /docs/CHECKSRC.md | |
parent | 063d3f3b96e40b3bf770d04d90612064b9a53c49 (diff) | |
download | curl-52fab72397687467650093c86e5479cb1d759042.tar.gz |
checksrc: complain on == NULL or != 0 checks in conditionsbagder/checksrc-conditions
... to make them all consistenly use if(!var) and if(var)
Also added a few missing warnings to the documentation.
Closes #6912
Diffstat (limited to 'docs/CHECKSRC.md')
-rw-r--r-- | docs/CHECKSRC.md | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/docs/CHECKSRC.md b/docs/CHECKSRC.md index d36763bc5..2f634c49e 100644 --- a/docs/CHECKSRC.md +++ b/docs/CHECKSRC.md @@ -33,8 +33,9 @@ warnings are: - `ASSIGNWITHINCONDITION`: Assignment within a conditional expression. The code style mandates the assignment to be done outside of it. -- `ASTERISKNOSPACE`: A pointer was declared like `char* name` instead of the more - appropriate `char *name` style. The asterisk should sit next to the name. +- `ASTERISKNOSPACE`: A pointer was declared like `char* name` instead of the + more appropriate `char *name` style. The asterisk should sit next to the + name. - `ASTERISKSPACE`: A pointer was declared like `char * name` instead of the more appropriate `char *name` style. The asterisk should sit right next to @@ -47,16 +48,28 @@ warnings are: strcat, strncat, gets are **never** allowed in curl source code. - `BRACEELSE`: '} else' on the same line. The else is supposed to be on the - following line. + following line. - `BRACEPOS`: wrong position for an open brace (`{`). +- `BRACEWHILE`: more than once space between end brace and while keyword + - `COMMANOSPACE`: a comma without following space - `COPYRIGHT`: the file is missing a copyright statement! - `CPPCOMMENTS`: `//` comment detected, that's not C89 compliant +- `DOBRACE`: only use one space after do before open brace + +- `EMPTYLINEBRACE`: found empty line before open brace + +- `EQUALSNOSPACE`: no space after `=` sign + +- `EQUALSNULL`: comparison with `== NULL` used in if/while. We use `!var`. + +- `EXCLAMATIONSPACE`: space found after exclamations mark + - `FOPENMODE`: `fopen()` needs a macro for the mode string, use it - `INDENTATION`: detected a wrong start column for code. Note that this @@ -70,6 +83,8 @@ warnings are: - `NOSPACEEQUALS`: An equals sign was found without preceding space. We prefer `a = 2` and *not* `a=2`. +- `NOTEQUALSZERO`: check found using `!= 0`. We use plain `if(var)`. + - `ONELINECONDITION`: do not put the conditional block on the same line as `if()` - `OPENCOMMENT`: File ended with a comment (`/*`) still "open". |