-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Add python3 script shebang lint #12972
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
Conversation
Good candidate for a lint? |
To the best of my knowledge, the script is outdated and won't produce test vectors in the current format. Since you are touching this file, might as well fix this in one go? |
Also the readme should be updated to reflect the new names, i.e. "src/test/data/key_io_valid.json" and "src/test/data/key_io_invalid.json" |
@Empact The linter you're thinking about would check that all |
@MarcoFalke since we don't generate testdata dynamically, should we delete this testgen directory? |
I don't know how to deal with |
Concept ACK adding the linter, however it should only return an error if there's a I don't think we should add shebangs to modules which aren't intended to be run as standalone executables. test-security-check.py was overlooked in #11881. You can convert it to Python3 with the following commit: jnewbery@35cb5da |
@ken2812221 What about this linter?
|
@practicalswift Seems your lint is flexible |
@jnewbery thanks |
utACK 294e59675bf326eb0e81a6685410f25df5619be4 |
contrib/testgen/base58.py
Outdated
@@ -1,3 +1,4 @@ | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't think base58.py requires a shebang. It's not executable:
→ ls -l contrib/testgen/base58.py
-rw-rw-r-- 1 ubuntu ubuntu 3092 Apr 13 14:37 contrib/testgen/base58.py
for PYTHON_FILE in $(git ls-files -- "*.py"); do | ||
if [[ $(head -c 2 "${PYTHON_FILE}") == "#!" && | ||
$(head -n 1 "${PYTHON_FILE}") != "#!/usr/bin/env python3" ]]; then | ||
echo "Missing shebang \"#!/usr/bin/env python3\" in ${PYTHON_FILE}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment could be clearer. Something like "Shebang must use python3 (not python or python2)"
utACK 2bff472 |
utACK 2bff472 |
utACK 2bff472 |
2bff472 [contrib] convert test-security-check to python3 (John Newbery) 958bf40 add lint tool to check python3 shebang (practicalswift) Pull request description: base58.py can executed by python3 Tree-SHA512: 30511204feefd4ccd5b4bf698fb88e516633e692dc95d31fe957b1c0c4879de25906355b28a5a0522171887315c8464a611e601ff00540db172d5bd463ee13d9
2bff472 [contrib] convert test-security-check to python3 (John Newbery) 958bf40 add lint tool to check python3 shebang (practicalswift) Pull request description: base58.py can executed by python3 Tree-SHA512: 30511204feefd4ccd5b4bf698fb88e516633e692dc95d31fe957b1c0c4879de25906355b28a5a0522171887315c8464a611e601ff00540db172d5bd463ee13d9
2bff472 [contrib] convert test-security-check to python3 (John Newbery) 958bf40 add lint tool to check python3 shebang (practicalswift) Pull request description: base58.py can executed by python3 Tree-SHA512: 30511204feefd4ccd5b4bf698fb88e516633e692dc95d31fe957b1c0c4879de25906355b28a5a0522171887315c8464a611e601ff00540db172d5bd463ee13d9
Backport useful lints from upstream Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6892 - bitcoin/bitcoin#11151 - bitcoin/bitcoin#11300 - bitcoin/bitcoin@96d91b7 - bitcoin/bitcoin#12097 - bitcoin/bitcoin#12098 - bitcoin/bitcoin#12442 - bitcoin/bitcoin#12572 - bitcoin/bitcoin#12757 - bitcoin/bitcoin#11878 - bitcoin/bitcoin#12933 - bitcoin/bitcoin#12871 - bitcoin/bitcoin#12972 - bitcoin/bitcoin#13281 - bitcoin/bitcoin#13385 - bitcoin/bitcoin#13041 - bitcoin/bitcoin#13454 - bitcoin/bitcoin#13448 - bitcoin/bitcoin#13510 - bitcoin/bitcoin#13851 - bitcoin/bitcoin#13863 - bitcoin/bitcoin#14115 - bitcoin/bitcoin#14831 - bitcoin/bitcoin#15164 - bitcoin/bitcoin#15170 - bitcoin/bitcoin#15166 - bitcoin/bitcoin#16036 - bitcoin/bitcoin#16768 Several of the lints fail for our current codebase; these will be addressed in a subsequent PR.
Backport useful lints from upstream Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6892 - bitcoin/bitcoin#11151 - bitcoin/bitcoin#11300 - bitcoin/bitcoin@96d91b7 - bitcoin/bitcoin#12097 - bitcoin/bitcoin#12098 - bitcoin/bitcoin#12442 - bitcoin/bitcoin#12572 - bitcoin/bitcoin#12757 - bitcoin/bitcoin#11878 - bitcoin/bitcoin#12933 - bitcoin/bitcoin#12871 - bitcoin/bitcoin#12972 - bitcoin/bitcoin#13281 - bitcoin/bitcoin#13385 - bitcoin/bitcoin#13041 - bitcoin/bitcoin#13454 - bitcoin/bitcoin#13448 - bitcoin/bitcoin#13510 - bitcoin/bitcoin#13851 - bitcoin/bitcoin#13863 - bitcoin/bitcoin#14115 - bitcoin/bitcoin#14831 - bitcoin/bitcoin#15164 - bitcoin/bitcoin#15170 - bitcoin/bitcoin#15166 - bitcoin/bitcoin#16036 - bitcoin/bitcoin#16768 - bitcoin/bitcoin#13494 Several of the lints fail for our current codebase; these will be addressed in a subsequent PR.
base58.py can executed by python3