aboutsummaryrefslogtreecommitdiff
path: root/lib/checksrc.pl
AgeCommit message (Collapse)Author
2019-11-08checksrc: repair the copyrightyear checkDaniel Stenberg
- 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
2019-10-01checksrc: fix uninitialized variable warningMarcel Raad
The loop doesn't need to be executed without a file argument. Closes https://github.com/curl/curl/pull/4444
2018-12-03checksrc: add COPYRIGHTYEAR checkDaniel Gustafsson
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>
2018-11-23checksrc: ban snprintf use, add command line flag to override warnsDaniel Stenberg
2018-10-05checksrc: handle zero scoped ignore commandsDaniel Gustafsson
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>
2018-10-05checksrc: enable strict mode and warningsDaniel Gustafsson
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>
2018-05-21checksrc: make sure sizeof() is used *with* parenthesesDaniel Stenberg
... and unify the source code to adhere. Closes #2563
2018-04-27checksrc: force indentation of lines after an elseDaniel Gustafsson
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
2018-04-15checksrc: Fix typoDaniel Gustafsson
Fix typo in "semicolon" spelling and remove stray tab character. Closes https://github.com/curl/curl/pull/2498
2018-03-12checksrc.pl: add -i and -m optionsViktor Szakats
To sync it with changes made for the libssh2 project. Also cleanup some whitespace.
2018-02-23spelling fixesViktor Szakats
Detected using the `codespell` tool. Also contains one URL protocol upgrade. Closes https://github.com/curl/curl/pull/2334
2018-01-07scripts: allow all perl scripts to be run directlyJay Satiro
- Enable execute permission (chmod +x) - Change interpreter to /usr/bin/env perl Closes https://github.com/curl/curl/pull/2222
2017-09-12checksrc: detect and warn for multiple spacesDaniel Stenberg
2017-09-12checksrc: verify space after semicolonsDaniel Stenberg
2017-09-11checksrc: detect and warn for lack of spaces next to plus signsDaniel Stenberg
2017-09-11checksrc: verify spaces around equals signsDaniel Stenberg
... as the code style mandates.
2017-09-02checksrc: disable SPACEBEFOREPAREN for case statement.Patrick Monnerat
The case keyword may be followed by a constant expression and thus should allow it to start with an open parenthesis.
2017-07-27checksrc: escape open brace in regexDaniel Stenberg
... to silence warning.
2016-12-19tests: checksrc complianceJay Satiro
2016-12-14checksrc: warn for assignments within if() expressionsDaniel Stenberg
... they're already frowned upon in our source code style guide, this now enforces the rule harder.
2016-12-13checksrc: stricter no-space-before-paren enforcementDaniel Stenberg
In order to make the code style more uniform everywhere
2016-11-24checksrc: detect wrongly placed open braces in func declarationsDaniel Stenberg
2016-11-24checksrc: verify ASTERISKNOSPACEDaniel Stenberg
Detects (char*) and 'char*foo' uses.
2016-11-24checksrc: add ASTERISKSPACEDaniel Stenberg
Verifies a 'char *name' style, with no space after the asterisk.
2016-09-07checksrc: detect strtok() useDaniel Stenberg
... as that function slipped through once before.
2016-06-05checksrc: Add LoadLibrary to the banned functions listJay Satiro
LoadLibrary was supplanted by Curl_load_library for security reasons in 6df916d.
2016-05-23checksrc.pl: Added variants of strcat() & strncat() to banned function listSteve Holme
Added support for checking the tchar, unicode and mbcs variants of strcat() and strncat() in the banned function list.
2016-04-19checksrc: taught to skip commentsDaniel Stenberg
... 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.
2016-04-03checksrc: check for more malplaced spacesDaniel Stenberg
2016-04-03checksrc: remove debug crapDaniel Stenberg
2016-04-03checksrc: allow ignore of specific warnings within a file (section)Daniel Stenberg
2016-04-03checksrc: add warning names, explain on help outputDaniel Stenberg
2016-04-03checksrc: improve the fopen() parser somewhatDaniel Stenberg
The quote scanner was too fragile, now look for a comma instead to find the mode argument.
2016-02-03URLs: change all http:// URLs to https://Daniel Stenberg
2015-10-21checksrc: add crude // detectionDaniel Stenberg
2015-06-02checksrc: detect fopen() for text without the FOPEN_* macrosDaniel Stenberg
Follow-up to e8423f9ce150 with discussionis in https://github.com/bagder/curl/pull/258 This check scans for fopen() with a mode string without 'b' present, as it may indicate that an FOPEN_* define should rather be used.
2015-03-30checksrc: Windows-specific input fixesJay Satiro
lib/config-win32ce.h - Fix whitespace for checksrc compliance. lib/checksrc.pl - Remove trailing carriage returns from input. projects/checksrc.bat - Ignore tool_hugehelp.c.
2015-03-17checksrc: Fix whitelist on out-of-tree buildsDan Fandrich
2015-03-17checksrc: detect and remove space before trailing semicolonsDaniel Stenberg
2015-03-17checksrc: introduce a whitelisting conceptDaniel Stenberg
2015-03-17checksrc: use space after commaDaniel Stenberg
2015-03-17checksrc: use space before paren in "return (expr);"Daniel Stenberg
2013-03-07checksrc: ban unsafe functionsDaniel Stenberg
The list of unsafe functions currently consists of sprintf, vsprintf, strcat, strncat and gets. Subsequently, some existing code needed updating to avoid warnings on this.
2011-09-07checksrc: detect "}else" uses as wellDaniel Stenberg
2011-08-05checksrc.pl: add quotes to varYang Tse
2011-08-05keep a single copy of config-win32.h in version control repository - followupYang Tse
Allow configure builds to generate src/config-win32.h Skip checksrc on src/config-win32.h contents already checked at lib/config-win32.h Allow multiple -W in checksrc.pl
2011-07-04checksrc: detect open brace without spaceDaniel Stenberg
We use "if(condition) {" with a space between the close paren and the open brace.
2011-05-26Make checksrc.pl work on more out-of-tree buildsYang Tse
Source files given with relative paths do not have the -D directory specifier prepended.
2011-05-16checksrc: trailing whitespace detection fixDaniel Stenberg
2011-04-27Make checksrc.pl work on out-of-tree buildsDan Fandrich
Source files given with absolute paths do not have the -D directory specifier prepended.