Skip to content

checksrc-all.pl: skip non-repository files#20439

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:chksrcgit
Closed

checksrc-all.pl: skip non-repository files#20439
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:chksrcgit

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 26, 2026

To avoid noise due to local C files when using automatic local checksrc
checks (e.g. via CMake -DCURL_LINT=ON option, or curl-lint target).

Also replace single-quote with double-quote in external git command, for
portability.

Follow-up to 88ff396 #17882
Follow-up to e785e89 #17376


https://github.com/curl/curl/pull/20439/files?w=1

Also replace single-quote with double-quote in external git commands
for portability.
@github-actions github-actions bot removed the tests label Jan 26, 2026
@vszakats vszakats closed this in 33f606c Jan 26, 2026
@vszakats vszakats deleted the chksrcgit branch January 26, 2026 15:08
@dfandrich
Copy link
Contributor

Doesn't this mean that new files won't get checked until they're committed? A developer could run all the tests, see that they're clean, then commit and push them upstream only to have CI complain. Could this instead check only C files that are a part of the build rather than those that are in git? How often are there actually C files in the curl source tree that devs want to skip?

@vszakats
Copy link
Member Author

vszakats commented Jan 27, 2026

Doesn't this mean that new files won't get checked until they're committed? A developer could run all the tests, see that they're clean, then commit and push them upstream only to have CI complain. Could this instead check only C files that are a part of the build rather than those that are in git? How often are there actually C files in the curl source tree that devs want to skip?

It means new files need to be git add-ed to be checked, yes. (but not
necessarily committed)

Speaking for myself, some misc C files are in the source tree all the time: Test
snippets, backup/previous/next/master versions for diffs, 3rd-party headers,
etc. It made me avoid automatic checksrc, and only used it occasionally on
individual files, which means issues were only caught in CI most of the time.

In my experience adding new C files happens less often than updating existing
ones. I guess it depends on personal workflow; for new files I tend to git add
and commit early, to track subsequent edits. (Also not to forget adding new files
at all, which happened quite a few times in early Git days!)

I expect this to allow running checksrc routinely or automatically, to catch
checksrc issues locally, without CI, in most cases.

That said, checksrc works differently with autotools: it's not using this script.
It also doesn't use a filesystem glob as this script did before this patch. Instead
it uses file lists from Makefile.inc/Makefile.am. This is more accurate than
git ls-files and also works outside a git sandbox. It also seems complex to
implement in Perl.

edit: FWIW, outside a git sandbox, this script continues using the filesystem
glob, as before this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants