tools for analyzing, updating and adding copyright headers in source files#8674
tools for analyzing, updating and adding copyright headers in source files#8674laanwj merged 1 commit intobitcoin:masterfrom
Conversation
|
I'm not sure that maintaining copyright headers is such an issue that it warrants splitting one tool into three. Interested in other opinions. |
|
Agree with @fanquake: I'd prefer to have the functionality (report and update) in a single script. Also, I don't think copyright_header_insert.py is required. (If someone forgets to add the header, they will forget to run the script as well) |
41745c4 to
74f2e24
Compare
|
I have condensed the three files into one and made them subcommands: becomes: running with no subcommand to copyright_header.py lists a usage string with the subcommands. Running a subcommand without arguments displays the subcommands usage string. If we are against the 'insert' functionality, I will remove it, however I think
|
|
You'll also need to update the contrib docs here. |
Three subcommands to this script: 1) ./copyright_header.py report Examines git-tracked files with extensions that match: INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.py'] Helps to: -> Identify source files without copyright -> Identify source files added with something other than "The Bitcoin Core developers" holder so we can be sure it is appropriate -> Identify unintentional typos in the copyright line 2) ./copyright_header.py update Replaces fix-copyright-headers.py. It does file editing in native python rather than subprocessing out to perl as was the case with fix-copyright-headers.py. It also shares code with the 'report' functions. 3) ./copyright_header.py insert Inserts a copyright header into a source file with the proper format and dates.
74f2e24 to
159597a
Compare
|
Concept ACK 159597a |
| ] | ||
| EXCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in EXCLUDE])) | ||
|
|
||
| INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.py'] |
There was a problem hiding this comment.
Probably should include *.sh, *.am, *.m4, and *.include
Might make more sense as an exclusion list...
There was a problem hiding this comment.
Leveldb does, though, but yes it makes no sense to include that here.
…rs in source files 159597a [devtools] script support for managing source file copyright headers (isle2983)
|
Who should run this and when? |
|
Good question. I have a working branch that hooks it into TravisCI to fail branches that are missing copyright headers - forcing the submitter to either add them or to manually exclude the file from the check. I plan on submitting the PR when I get the chance to polish it a bit more If the overall feeling is that this kind of thing is helpful and not a pain for day-to-day work, there might be utility in doing similar scripts for TravisCI to gradually ratchet in enforcement of basic whitespace rules and/or eventually clang-format and/or pylint style checks. Also, the years in the headers need to be upgraded every so often to make sure they are current. December 31st might be a good day to run the script and post the PR. |
|
This is a port of Core #8674 Three subcommands to this script: 1) ./copyright_header.py report Examines git-tracked files with extensions that match: INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.py'] Helps to: -> Identify source files without copyright -> Identify source files added with something other than "The Bitcoin Core developers" holder so we can be sure it is appropriate -> Identify unintentional typos in the copyright line 2) ./copyright_header.py update Replaces fix-copyright-headers.py. It does file editing in native python rather than subprocessing out to perl as was the case with fix-copyright-headers.py. It also shares code with the 'report' functions. 3) ./copyright_header.py insert Inserts a copyright header into a source file with the proper format and dates.
* [devtools] script support for managing source file copyright headers This is a port of Core #8674 Three subcommands to this script: 1) ./copyright_header.py report Examines git-tracked files with extensions that match: INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.py'] Helps to: -> Identify source files without copyright -> Identify source files added with something other than "The Bitcoin Core developers" holder so we can be sure it is appropriate -> Identify unintentional typos in the copyright line 2) ./copyright_header.py update Replaces fix-copyright-headers.py. It does file editing in native python rather than subprocessing out to perl as was the case with fix-copyright-headers.py. It also shares code with the 'report' functions. 3) ./copyright_header.py insert Inserts a copyright header into a source file with the proper format and dates. * [scripts] Add missing univalue file to copyright_header.py * Adapt copyright_header.py to the BU repo - add a new set of expected copyright holders - define "The Bitcoin Unlimited developers" as the default copyright holder
…t headers in source files 159597a [devtools] script support for managing source file copyright headers (isle2983)
…t headers in source files 159597a [devtools] script support for managing source file copyright headers (isle2983)
Three scripts in contrib/devtools/ are introduced:
copyright_header_report.py
copyright_header_update.py
copyright_header_insert.py
Altogether, I hope they make the task of managing the copyright headers a bit
easier.