summaryrefslogtreecommitdiff
path: root/lib/checksrc.pl
Commit message (Collapse)AuthorAgeFilesLines
* checksrc: complain on == NULL or != 0 checks in conditionsbagder/checksrc-conditionsDaniel Stenberg2021-04-221-1/+18
| | | | | | | | ... to make them all consistenly use if(!var) and if(var) Also added a few missing warnings to the documentation. Closes #6912
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* checksrc: warn on empty line before open braceDaniel Stenberg2020-10-151-0/+6
| | | | | | ... and fix a few occurances Closes #6088
* checksrc: detect // comments on column 0Daniel Stenberg2020-10-071-1/+1
| | | | | | Spotted while working on #6045 Closes #6048
* checksrc: warn on space after exclamation markDaniel Stenberg2020-10-021-0/+7
| | | | Closes #6034
* src: Consistently spell whitespace without whitespaceDaniel Gustafsson2020-09-301-2/+2
| | | | | | | | | Whitespace is spelled without a space between white and space, so make sure to consistently spell it that way across the codebase. Closes #6023 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Emil Engler <me@emilengler.com>
* checksrc: verify do-while and spaces between the bracesDaniel Stenberg2020-08-241-0/+10
| | | | | | Updated mprintf.c to comply Closes #5845
* checksrc: ban gmtime/localtimeDaniel Stenberg2020-07-281-1/+2
| | | | | | | | | They're not thread-safe so they should not be used in libcurl code. Explictly enabled when deemed necessary and in examples and tests Reviewed-by: Nicolas Sterchele Closes #5732
* wording: avoid blacklist/whitelist stereotypesDaniel Stenberg2020-06-101-9/+9
| | | | | | | | Instead of discussing if there's value or meaning (implied or not) in the colors, let's use words without the same possibly negative associations. Closes #5546
* source cleanup: remove all custom typedef structsDaniel Stenberg2020-05-151-0/+16
| | | | | | | | | | | - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
* checksrc: enhance the ASTERISKSPACE and update code accordinglyDaniel Stenberg2020-05-141-3/+3
| | | | | | | | Fine: "struct hello *world" Not fine: "struct hello* world" (and variations) Closes #5386
* checksrc: close the .checksrc file handle when done readingDaniel Stenberg2020-05-081-0/+1
|
* checksrc: warn on obvious conditional blocks on the same line as if()Daniel Stenberg2020-03-301-2/+24
| | | | Closes #5164
* copyright: fix out-of-date copyright ranges and missing headersDaniel Stenberg2020-03-241-1/+1
| | | | | | | | | Reported by the new script 'scripts/copyright.pl'. The script has a regex whitelist for the files that don't need copyright headers. Removed three (mostly usesless) README files from docs/ Closes #5141
* perl: align order and completeness of Windows OS checksMarc Hoersken2020-03-071-1/+1
|
* Revert "checksrc: fix regexp for ASSIGNWITHINCONDITION"Daniel Stenberg2019-12-161-1/+1
| | | | | | This reverts commit ba82673dac3e8d00a76aa5e3779a0cb80e7442af. Bug: #4683
* checksrc: fix regexp for ASSIGNWITHINCONDITIONDaniel Gustafsson2019-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | | The regexp looking for assignments within conditions was too greedy and matched a too long string in the case of multiple conditionals on the same line. This is basically only a problem in single line macros, and the code which exemplified this was essentially: do { if((x) != NULL) { x = NULL; } } while(0) ..where the final parenthesis of while(0) matched the regexp, and the legal assignment in the block triggered the warning. Fix by making the regexp less greedy by matching for the tell-tale signs of the if statement ending. Also remove the one occurrence where the warning was disabled due to a construction like the above, where the warning didn't apply when fixed. Closes #4647 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* checksrc: repair the copyrightyear checkDaniel Stenberg2019-11-081-4/+9
| | | | | | | | | | | | | | | | | | | | - Consider a modified file to be committed this year. - Make the travis CHECKSRC also do COPYRIGHTYEAR scan in examples and includes - Ignore 0 parents when getting latest commit date of file. since in the CI we're dealing with a truncated repo of last 50 commits, the file's most recent commit may not be available. when this happens git log and rev-list show the initial commit (ie first commit not to be truncated) but that's incorrect so ignore it. Ref: https://github.com/curl/curl/pull/4547 Closes https://github.com/curl/curl/pull/4549 Co-authored-by: Jay Satiro
* checksrc: fix uninitialized variable warningMarcel Raad2019-10-011-1/+1
| | | | | | The loop doesn't need to be executed without a file argument. Closes https://github.com/curl/curl/pull/4444
* checksrc: add COPYRIGHTYEAR checkDaniel Gustafsson2018-12-031-5/+86
| | | | | | | | | | | | | | | | | | | | Forgetting to bump the year in the copyright clause when hacking has been quite common among curl developers, but a traditional checksrc check isn't a good fit as it would penalize anyone hacking on January 1st (among other things). This adds a more selective COPYRIGHTYEAR check which intends to only cover the currently hacked on changeset. The check for updated copyright year is currently not enforced on all files but only on files edited and/or committed locally. This is due to the amount of files which aren't updated with their correct copyright year at the time of their respective commit. To further avoid running this expensive check for every developer, it adds a new local override mode for checksrc where a .checksrc file can be used to turn on extended warnings locally. Closes #3303 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* checksrc: ban snprintf use, add command line flag to override warnsDaniel Stenberg2018-11-231-0/+27
|
* checksrc: handle zero scoped ignore commandsDaniel Gustafsson2018-10-051-1/+10
| | | | | | | | | | | | | | | | If a !checksrc! disable command specified to ignore zero errors, it was still added to the ignore block even though nothing was ignored. While there were no blocks ignored that shouldn't be ignored, the processing ended with with a warning: <filename>:<line>:<col>: warning: Unused ignore: LONGLINE (UNUSEDIGNORE) /* !checksrc! disable LONGLINE 0 */ ^ Fix by instead treating a zero ignore as a a badcommand and throw a warning for that one. Closes #3096 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* checksrc: enable strict mode and warningsDaniel Gustafsson2018-10-051-8/+18
| | | | | | | | | | | | | | | | | | Enable strict and warnings mode for checksrc to ensure we aren't missing anything due to bugs in the checking code. This uncovered a few things which are all fixed in this commit: * several variables were used uninitialized * several variables were not defined in the correct scope * the whitelist filehandle was read even if the file didn't exist * the enable_warn() call when a disable counter had expired was passing incorrect variables, but since the checkwarn() call is unlikely to hit (the counter is only decremented to zero on actual ignores) it didn't manifest a problem. Closes #3090 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com>
* checksrc: make sure sizeof() is used *with* parenthesesDaniel Stenberg2018-05-211-0/+12
| | | | | | ... and unify the source code to adhere. Closes #2563
* checksrc: force indentation of lines after an elseDaniel Gustafsson2018-04-271-4/+4
| | | | | | | | This extends the INDENTATION case to also handle 'else' statements and require proper indentation on the following line. Also fixes the offending cases found in the codebase. Closes #2532
* checksrc: Fix typoDaniel Gustafsson2018-04-151-4/+4
| | | | | | Fix typo in "semicolon" spelling and remove stray tab character. Closes https://github.com/curl/curl/pull/2498
* checksrc.pl: add -i and -m optionsViktor Szakats2018-03-121-6/+18
| | | | | To sync it with changes made for the libssh2 project. Also cleanup some whitespace.
* spelling fixesViktor Szakats2018-02-231-5/+5
| | | | | | | | Detected using the `codespell` tool. Also contains one URL protocol upgrade. Closes https://github.com/curl/curl/pull/2334
* scripts: allow all perl scripts to be run directlyJay Satiro2018-01-071-1/+1
| | | | | | | | - Enable execute permission (chmod +x) - Change interpreter to /usr/bin/env perl Closes https://github.com/curl/curl/pull/2222
* checksrc: detect and warn for multiple spacesDaniel Stenberg2017-09-121-0/+13
|
* checksrc: verify space after semicolonsDaniel Stenberg2017-09-121-0/+8
|
* checksrc: detect and warn for lack of spaces next to plus signsDaniel Stenberg2017-09-111-0/+13
|
* checksrc: verify spaces around equals signsDaniel Stenberg2017-09-111-1/+17
| | | | ... as the code style mandates.
* checksrc: disable SPACEBEFOREPAREN for case statement.Patrick Monnerat2017-09-021-0/+3
| | | | | The case keyword may be followed by a constant expression and thus should allow it to start with an open parenthesis.
* checksrc: escape open brace in regexDaniel Stenberg2017-07-271-2/+2
| | | | ... to silence warning.
* tests: checksrc complianceJay Satiro2016-12-191-1/+2
|
* checksrc: warn for assignments within if() expressionsDaniel Stenberg2016-12-141-0/+8
| | | | | ... they're already frowned upon in our source code style guide, this now enforces the rule harder.
* checksrc: stricter no-space-before-paren enforcementDaniel Stenberg2016-12-131-2/+18
| | | | In order to make the code style more uniform everywhere
* checksrc: detect wrongly placed open braces in func declarationsDaniel Stenberg2016-11-241-0/+13
|
* checksrc: verify ASTERISKNOSPACEDaniel Stenberg2016-11-241-3/+10
| | | | Detects (char*) and 'char*foo' uses.
* checksrc: add ASTERISKSPACEDaniel Stenberg2016-11-241-1/+8
| | | | Verifies a 'char *name' style, with no space after the asterisk.
* checksrc: detect strtok() useDaniel Stenberg2016-09-071-0/+1
| | | | ... as that function slipped through once before.
* checksrc: Add LoadLibrary to the banned functions listJay Satiro2016-06-051-1/+7
| | | | | LoadLibrary was supplanted by Curl_load_library for security reasons in 6df916d.
* checksrc.pl: Added variants of strcat() & strncat() to banned function listSteve Holme2016-05-231-1/+1
| | | | | Added support for checking the tchar, unicode and mbcs variants of strcat() and strncat() in the banned function list.
* checksrc: taught to skip commentsDaniel Stenberg2016-04-191-7/+48
| | | | | | | ... but output non-stripped version of the line, even if that then can make the script identify the wrong position in the line at times. Showing the line stripped (ie without comments) is just too surprising.
* checksrc: check for more malplaced spacesDaniel Stenberg2016-04-031-12/+24
|
* checksrc: remove debug crapDaniel Stenberg2016-04-031-1/+0
|
* checksrc: allow ignore of specific warnings within a file (section)Daniel Stenberg2016-04-031-2/+107
|
* checksrc: add warning names, explain on help outputDaniel Stenberg2016-04-031-21/+70
|
* checksrc: improve the fopen() parser somewhatDaniel Stenberg2016-04-031-5/+5
| | | | | The quote scanner was too fragile, now look for a comma instead to find the mode argument.