Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checksrc: add COPYRIGHT year check #3303

Closed

Conversation

danielgustafsson
Copy link
Member

This is a patch which I had shelved deeming it too uninteresting/complicated to be useful, but when discussing the recent snprintf() switcheroo in #3297 the topic was brought up again. This is more of a discussion piece/show-and-tell PR than something I really think we should do, but working code is generally nicer to discuss around than handwaving so here goes.

The check for updated copyright year is currently not enforced on any file 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. If enforced for the correct year, there are hundreds of errors which is painful. We could of course just sed the list of files to the current year and be done with it, but then we could just as well bump every file in the tree and there are reasons why we don't do that.

Invoking the checking like in this patch is rather expensive, and obviously only works on cloned repos and not source tarballs (which in this day and age really isn't used for active development anyways).

@danielgustafsson
Copy link
Member Author

The good thing about this PR is that it seem to work, the bad part is that this option makes make checksrc really slow. Some unscientific wallclock testing puts the overhead at ~4x, going from ~4.2s to ~18s on my laptop. That's clearly pretty useless for normal development so it would need to be turned off by default IMO. The question is how it should be invoked? Should we have a make checksrs-release target with extended checks like this one to be run before shipping a release (and in Travis of course) to ensure we are up to date? Thoughts?

@danielgustafsson danielgustafsson changed the title [RFC] checksrc: add COPYRIGHT year check checksrc: add COPYRIGHT year check Nov 28, 2018
@bagder
Copy link
Member

bagder commented Nov 28, 2018

I agree that this heavy impact would be unfortunate to impose on everyone by default. But I would like to come up with a system that allows me personally to have this run in my local dev environment! Possibly we can support this by simply making checksrc support a local file for extra options or something so that I can just put a "lib/.checksrc" file in there specifying the extra option to use in that dir?

I also think we should adjust the travis checksrc job to make sure it runs this copyright check as well.

@danielgustafsson
Copy link
Member Author

Possibly we can support this by simply making checksrc support a local file for extra options or something so that I can just put a "lib/.checksrc" file in there specifying the extra option to use in that dir?

I like this idea so I've implemented it and pushed a rebase which contains support for enabling extended checks in $dir/.checksrc.

I also think we should adjust the travis checksrc job to make sure it runs this copyright check as well.

Unless I botched it from not really knowing Travis configuration very well, the second commit in this PR should enable it in Travis.

Copy link
Member

@bagder bagder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it! The travis check should probably also be done for src/ and include/curl but this is great start!

@danielgustafsson
Copy link
Member Author

Thanks for the review! Just realized that I have forgotten to add this to docs/CHECKSRC.md, will do that before pushing.

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 any
file 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.
The extended warning for checking incorrect COPYRIGHTYEAR is quite
expensive to run so rather than expecting every developer to do it
we ensure it's turned on locally for Travis.
@lock lock bot locked as resolved and limited conversation to collaborators Mar 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants