-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
lint: convert format strings linter test to python #24802
Conversation
396ed2c
to
c4f7833
Compare
c4f7833
to
08de596
Compare
I think calling out to
I don't know the original motivation, the only thing I can think of is that printing errors in with the files in a deterministic sorted order is somewhat-user-friendly. But I don't think it's a big deal. |
ed2ade4
to
879c836
Compare
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.
utACK 879c836
test/lint/lint-format-strings.py
Outdated
#!/usr/bin/env python3 | ||
# | ||
# Copyright (c) 2018-2020 The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
# | ||
|
||
""" | ||
Lint format strings: This program checks that the number of arguments passed | ||
to a variadic format string function matches the number of format specifiers | ||
in the format string. | ||
""" |
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.
#!/usr/bin/env python3 | |
# | |
# Copyright (c) 2018-2020 The Bitcoin Core developers | |
# Distributed under the MIT software license, see the accompanying | |
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
# | |
""" | |
Lint format strings: This program checks that the number of arguments passed | |
to a variadic format string function matches the number of format specifiers | |
in the format string. | |
""" | |
#!/usr/bin/env python3 | |
""" | |
Lint format strings: This program checks that the number of arguments passed | |
to a variadic format string function matches the number of format specifiers | |
in the format string. | |
Copyright (c) 2018-2020 The Bitcoin Core developers | |
Distributed under the MIT software license, see the accompanying | |
file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
""" |
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.
Previously ported python scripts have the copyright comment in the way, existing version of this PR has it. Changing it to the suggested way might make it appear inconsistent with other lint files. Do you still suggest changing ?
From reading the code it looks like all output and stderr are muted. If yes, why? If no, please provide example stdout/stderr of the test before and after this change. |
879c836
to
267684e
Compare
@MarcoFalke Thanks for highlighting that! That led me to update this PR so output matches with the older version. The reason why before version has 3 lines printed and not 2 is due to the issue highlighed in point (3) in the additional notes of PR header section. IMO the new version is the intended behavior. |
Code review ACK 267684e |
|
||
def check_doctest(): | ||
command = [ | ||
'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.
wouldn't it be better to use sys.executable?
Refs #24783
Attempted to keep the style and flow of implementation as it is.
Additional Notes(Optional):
git grep
withsubprocess
is still used as I found it to be the simplest. Any pointers on this are appreciated.function_names
iterated so far. Fixed that in this PR.