Add autoformat option to CLI - #1395
Conversation
Coverage Report for CI Build 36092919400Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.004%) to 90.911%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
|
||
|
|
||
| def _invoke_checker(checker, paths, config, output_format): | ||
| def _invoke_checker(checker, paths, config, output_format, autoformat): |
There was a problem hiding this comment.
Add a type annotation for the autoformat parameter (this will make merging with @rachelzUT's current task easier later)
|
|
||
| def fake_checker(*, module_name, **kwargs): | ||
| calls.append({"module_name": module_name, "kwargs": kwargs}) | ||
| def fake_checker(*, module_name, autoformat): |
There was a problem hiding this comment.
Let's improve the existing pattern of the fake_checker (throughout this file).
-
Modify the
__main__.pyfile itself to pass all of the arguments tocheck_all/check_errorsas keyword arguments instead of positional arguments. -
Pull out the definition of
fake_checkerinto a single factory function instead of redefining it in all tests. The factory function should take incallsand return the actualfake_checkerfunction.def mock_checker(calls: list) -> Callable[..., BaseReporter]:
-
The interface for the inner
fake_checkerfunction should just be to takemodule_nameand**kwargsand store them incalls, like the original code here did. You can extract specific keyword arguments fromkwargsin the individual test cases.
david-yz-liu
left a comment
There was a problem hiding this comment.
Nice work, @PraneethS42!
Proposed Changes
These changes update the PyTA CLI to take an option
--autoformat. When enabled, PyTA runs Black on the supplied files before analyzing them, matching the pre-existingautoformat=Trueargument incheck_allandcheck_errors.The option is forwarded through all CLI configuration paths, and remains disabled by default. Created tests cover both checker modes and the default behaviour.
...
Screenshots of your changes (if applicable)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)