-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[WIP] python: Integrate linting/utils/tests #15833
Conversation
56cd4db
to
2e3ef71
Compare
tools/base/checker.py
Outdated
resp = self.fork(["bazel", "query", f"'{query}'"]) | ||
return resp.stdout.decode("utf-8").split("\n") | ||
|
||
def error(self, name: str, errors: list, log: bool = True) -> str: |
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.
add a comment about only calling these once per check::subcheck - ie check on a file
360bed2
to
7787031
Compare
b3a6edd
to
4fb8512
Compare
/retest |
Retrying Azure Pipelines: |
tools/base/checker.py
Outdated
class Checker(object): | ||
"""Runs check methods prefixed with `check_` and named in `self.checks` | ||
|
||
check methods should return the count of errors and log warnings and errors |
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.
better explanation.
@htuch @mattklein123 this should be ready for review please see the updated description for an explanation as to what the pr does |
i have a few cleanups left, but just nits i think |
# | ||
# bazel //tools/dependency:pip_check -- -h | ||
# | ||
# alternatively, if you have the necessary python deps available |
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.
no deps required
tools/code_format/python_check.py
Outdated
# - isort | ||
|
||
|
||
class PythonChecker(checker.ForkingChecker): |
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.
add some docstrings
tools/base/checker.py
Outdated
return self.summary_class(self) | ||
|
||
@property | ||
def summary_class(self): |
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.
hint
tools/base/checker.py
Outdated
return 1 if self.has_failed else 0 | ||
|
||
def run_checks(self) -> int: | ||
"""Run all configured checks and return the sum of their error counts""" |
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.
wrong description
tools/base/checker.py
Outdated
"""Maximum warnings to display in summary""" | ||
return self.checker.args.summary_warnings | ||
|
||
def print_failed(self, problem_type): |
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.
hint
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.
failed is not necessarily correct/ambiguous
tools/base/utils.py
Outdated
yield | ||
|
||
if stdout is not None: | ||
_stdout.seek(0) |
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.
unnecessary seek
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.
@phlax is there any way to split this up into multiple PRs? It's pretty huge, would prefer to eat the elephant a bite at a time.
08dbe08
to
d74ce0c
Compare
d74ce0c
to
98300f6
Compare
this has now landed in other prs |
another breakout from #15833 Signed-off-by: Ryan Northey <ryan@synca.io>
another breakout from envoyproxy#15833 Signed-off-by: Ryan Northey <ryan@synca.io> Signed-off-by: Gokul Nair <gnair@twitter.com>
Signed-off-by: Ryan Northey ryan@synca.io
Commit Message: python: Integrate linting/utils/tests
Additional Description:
This PR:
Checker
check runnerRunner
with argparseRisk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]