Followsup to #34106 (comment).
lint: check copyright headers #36967
pull fanquake wants to merge 3 commits into bitcoin:master from fanquake:lint_copyright_header changing 27 files +138 −22-
fanquake commented at 5:34 PM on November 24, 2026: member
- DrahtBot added the label Tests on Nov 24, 2026
-
DrahtBot commented at 5:34 PM on November 24, 2026: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
External sites
- Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36967
- Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36967.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36967#author-ralph
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline and AI policy for information on the review process.
Type Reviewers ACK stickies-v If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
stickies-v commented at 6:47 PM on November 24, 2026: contributor
Concept ACK, less review burden when this is automatically checked.
I think in a follow-up we should just bite the bullet and standardize everything to a single
Copyright (c) The Bitcoin Core developersheader, but best to get this in first. -
in test/lint/test_runner/src/lint_docs.rs:18 in f440ec6b9b
14 | + let mut lines = text 15 | + .lines() 16 | + .map(|line| line.trim_start_matches("// ").trim_start_matches("# ")); 17 | + 18 | + lines 19 | + .find(|line| line.starts_with("Copyright") && line.ends_with("Bitcoin Core developers"))
maflcko commented at 6:51 PM on November 24, 2026:I think there is one ci file which is missing the
The..find(|line| line.starts_with("Copyright") && line.ends_with("The Bitcoin Core developers"))could make sense to add it in both?
fanquake commented at 9:16 AM on November 25, 2026:Thanks, changed both.
maflcko approvedmaflcko commented at 6:52 PM on November 24, 2026: memberthx, I think it makes sense to automate this boilerplate going forward, instead of spending manual (recurring) review on this.
fanquake force-pushed on Nov 25, 2026in test/lint/test_runner/src/lint_docs.rs:34 in 2dfb2ab5e0 outdated
30 | + let files = check_output( 31 | + git() 32 | + .args([ 33 | + "ls-files", 34 | + "--full-name", 35 | + "--",
stickies-v commented at 11:52 AM on November 25, 2026:I think .rs, .cmake and CMakeLists files are also common enough to be included here?
in test/lint/test_runner/src/lint_docs.rs:77 in 2dfb2ab5e0
73 | + .collect(); 74 | + 75 | + if !missing_headers.is_empty() { 76 | + println!("{}", missing_headers.join("\n")); 77 | + Err(r#" 78 | +Exclude the above paths or add the missing copyright headers.
stickies-v commented at 11:54 AM on November 25, 2026:nit
Add the missing copyright headers, or exclude the above paths if not applicable.in test/lint/test_runner/src/lint_docs.rs:12 in 2dfb2ab5e0 outdated
5 | @@ -6,7 +6,85 @@ use std::fs; 6 | use std::io::ErrorKind; 7 | use std::process::{Command, Stdio}; 8 | 9 | -use crate::util::{check_output, get_subtrees, git, LintResult}; 10 | +use crate::util::{check_output, get_pathspecs_default_excludes, get_subtrees, git, LintResult}; 11 | + 12 | +fn has_copyright_header(file: &str) -> bool { 13 | + let text = fs::read_to_string(file).expect("File should be readable");
stickies-v commented at 12:07 PM on November 25, 2026:nit: might be useful to feedback which file failed? my llm tells me
let text = fs::read_to_string(file).unwrap_or_else(|e| panic!("Failed to read {file}: {e}"));would be a good alternative but i'm not a rustacean.in test/lint/test_runner/src/lint_docs.rs:42 in 2dfb2ab5e0 outdated
38 | + "*.h", 39 | + "*.sh", 40 | + ]) 41 | + .args(get_pathspecs_default_excludes()) 42 | + .args([ 43 | + // External copyright.
stickies-v commented at 12:16 PM on November 25, 2026:Many of these are MIT license and heavily modified by us, so I think we can just merge headers and remove exclusion for a lot of these?
<details> <summary>git diff on 2dfb2ab5e0</summary>
diff --git a/contrib/asmap/asmap-tool.py b/contrib/asmap/asmap-tool.py index b594e4796a..469a6fb472 100755 --- a/contrib/asmap/asmap-tool.py +++ b/contrib/asmap/asmap-tool.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 # Copyright (c) 2022 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying -# file LICENSE or http://www.opensource.org/licenses/mit-license.php. +# file COPYING or http://www.opensource.org/licenses/mit-license.php. import argparse import sys diff --git a/contrib/asmap/asmap.py b/contrib/asmap/asmap.py index 292048b6d8..f4498c0413 100644 --- a/contrib/asmap/asmap.py +++ b/contrib/asmap/asmap.py @@ -1,6 +1,7 @@ # Copyright (c) 2022 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying -# file LICENSE or http://www.opensource.org/licenses/mit-license.php. +# file COPYING or http://www.opensource.org/licenses/mit-license.php. """ This module provides the ASNEntry and ASMap classes. diff --git a/contrib/devtools/headerssync-params.py b/contrib/devtools/headerssync-params.py index 884e00cd7d..4efbc9cabd 100755 --- a/contrib/devtools/headerssync-params.py +++ b/contrib/devtools/headerssync-params.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) 2022 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/contrib/guix/symbol-check.py b/contrib/guix/symbol-check.py index 42d20dc314..393d95bf4b 100755 --- a/contrib/guix/symbol-check.py +++ b/contrib/guix/symbol-check.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) 2014 Wladimir J. van der Laan +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' diff --git a/src/cuckoocache.h b/src/cuckoocache.h index a064607537..4f78cca5ee 100644 --- a/src/cuckoocache.h +++ b/src/cuckoocache.h @@ -1,4 +1,5 @@ // Copyright (c) 2016 Jeremy Rubin +// Copyright (c) The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/test/torcontrol_tests.cpp b/src/test/torcontrol_tests.cpp index 659caaef61..96ff2ac59d 100644 --- a/src/test/torcontrol_tests.cpp +++ b/src/test/torcontrol_tests.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2017 The Zcash developers +// Copyright (c) The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // diff --git a/test/functional/test_framework/crypto/muhash.py b/test/functional/test_framework/crypto/muhash.py index 09241f6203..b331fce562 100644 --- a/test/functional/test_framework/crypto/muhash.py +++ b/test/functional/test_framework/crypto/muhash.py @@ -1,4 +1,5 @@ # Copyright (c) 2020 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Native Python MuHash3072 implementation.""" diff --git a/test/functional/test_framework/crypto/ripemd160.py b/test/functional/test_framework/crypto/ripemd160.py index 12801364b4..7fdb19e5c8 100644 --- a/test/functional/test_framework/crypto/ripemd160.py +++ b/test/functional/test_framework/crypto/ripemd160.py @@ -1,4 +1,5 @@ # Copyright (c) 2021 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test-only pure Python RIPEMD160 implementation.""" diff --git a/test/functional/test_framework/descriptors.py b/test/functional/test_framework/descriptors.py index 0f65f63d6b..b6ad72d99c 100644 --- a/test/functional/test_framework/descriptors.py +++ b/test/functional/test_framework/descriptors.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) 2019 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Utility functions related to output descriptors""" diff --git a/test/functional/test_framework/key.py b/test/functional/test_framework/key.py index 40c76e29fa..4a775ea0a0 100644 --- a/test/functional/test_framework/key.py +++ b/test/functional/test_framework/key.py @@ -1,4 +1,5 @@ # Copyright (c) 2019-2020 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test-only secp256k1 elliptic curve protocols implementation diff --git a/test/functional/test_framework/segwit_addr.py b/test/functional/test_framework/segwit_addr.py index 861ca2b949..32c6e3e294 100644 --- a/test/functional/test_framework/segwit_addr.py +++ b/test/functional/test_framework/segwit_addr.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 # Copyright (c) 2017 Pieter Wuille +# Copyright (c) The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Reference implementation for Bech32/Bech32m and segwit addresses.""" diff --git a/test/lint/test_runner/src/lint_docs.rs b/test/lint/test_runner/src/lint_docs.rs index 34d2162c20..611395ec14 100644 --- a/test/lint/test_runner/src/lint_docs.rs +++ b/test/lint/test_runner/src/lint_docs.rs @@ -40,25 +40,14 @@ pub fn lint_copyright_doc() -> LintResult { .args(get_pathspecs_default_excludes()) .args([ // External copyright. - ":(exclude)contrib/asmap/asmap-tool.py", - ":(exclude)contrib/asmap/asmap.py", ":(exclude)contrib/devtools/clang-format-diff.py", - ":(exclude)contrib/devtools/headerssync-params.py", - ":(exclude)contrib/guix/symbol-check.py", ":(exclude)src/bench/nanobench.h", - ":(exclude)src/cuckoocache.h", ":(exclude)src/test/fuzz/FuzzedDataProvider.h", - ":(exclude)src/test/torcontrol_tests.cpp", ":(exclude)src/tinyformat.h", ":(exclude)src/univalue/include/univalue_utffilter.h", ":(exclude)src/univalue/lib/univalue_write.cpp", ":(exclude)src/util/subprocess.h", ":(exclude)test/functional/test_framework/authproxy.py", - ":(exclude)test/functional/test_framework/crypto/muhash.py", - ":(exclude)test/functional/test_framework/crypto/ripemd160.py", - ":(exclude)test/functional/test_framework/descriptors.py", - ":(exclude)test/functional/test_framework/key.py", - ":(exclude)test/functional/test_framework/segwit_addr.py", // Empty Python package marker files. ":(exclude,glob)**/__init__.py", ]),</details>
fanquake commented at 2:42 PM on November 25, 2026:I think you're right. Have pushed that up.
stickies-v approvedstickies-v commented at 12:17 PM on November 25, 2026: contributorACK 2dfb2ab5e0ff7ad40bcedf13f20f7e07cd6106d7, non-blocking suggestions
fanquake force-pushed on Nov 25, 2026in test/lint/test_runner/src/lint_docs.rs:48 in 6e41bf7f14
44 | + // External copyright. 45 | + ":(exclude)contrib/devtools/clang-format-diff.py", 46 | + ":(exclude)src/bench/nanobench.h", 47 | + ":(exclude)src/test/fuzz/FuzzedDataProvider.h", 48 | + ":(exclude)src/tinyformat.h", 49 | + ":(exclude)src/univalue/include/univalue_utffilter.h",
maflcko commented at 3:12 PM on November 25, 2026:I think this was written by Mara for Bitcoin Core, not external
fanquake commented at 3:35 PM on November 25, 2026:Made not-external.
fanquake force-pushed on Nov 25, 2026in src/univalue/include/univalue_utffilter.h:1 in aac628b87d outdated
stickies-v commented at 3:21 PM on November 25, 2026:nit: this diff is in the wrong commit
fanquake commented at 3:35 PM on November 25, 2026:Thanks, fixed.
stickies-v approvedstickies-v commented at 3:22 PM on November 25, 2026: contributorre-ACK 19f4b1f32fcf544d3008355c2dc42c13d3638776
refactor: add or fix copyright headers f206c65852contrib: add shebang to asmap.py e743b8ed38lint: add copyright header linter 801b7e82b4fanquake force-pushed on Nov 25, 2026stickies-v commented at 11:44 AM on November 26, 2026: contributorre-ACK 801b7e82b4
fanquake merged this on Nov 26, 2026fanquake closed this on Nov 26, 2026fanquake deleted the branch on Nov 26, 2026
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-12-04 12:51 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me