-
Notifications
You must be signed in to change notification settings - Fork 65
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
Expose ipc_main
with arguments instead of argparse
#175
Conversation
Codecov Report
@@ Coverage Diff @@
## master #175 +/- ##
==========================================
+ Coverage 85.04% 85.88% +0.84%
==========================================
Files 89 90 +1
Lines 3623 3691 +68
==========================================
+ Hits 3081 3170 +89
+ Misses 542 521 -21
Continue to review full report at Codecov.
|
4a96daf
to
68e21db
Compare
fixit/cli/__init__.py
Outdated
def ipc_main(opts: LintOpts) -> IPCResult: | ||
""" | ||
Like `run_ipc` instead this function expects arguments to be collected through argparse. | ||
This IPC helper takes paths of source files from either a path file (with @paths arg) | ||
or a list of paths as args. | ||
|
||
Returns an IPCResult object. | ||
""" | ||
parser = argparse.ArgumentParser( | ||
description="Runs Fixit lint rules and print results as console output.", | ||
fromfile_prefix_chars="@", | ||
parents=[get_multiprocessing_parser()], | ||
) | ||
parser.add_argument("paths", nargs="*", help="List of paths to run lint rules on.") | ||
parser.add_argument("--prefix", help="A prefix to be added to all paths.") | ||
args: argparse.Namespace = parser.parse_args() | ||
|
||
return run_ipc( | ||
opts=opts, paths=args.paths, prefix=args.prefix, workers=args.workers | ||
) |
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.
Let's deprecate this.
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.
👍 Added a deprecation warning using python's standard warnings.warn
functionality.
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.
Looks good!
Summary
Refactored
ipc_main
intorun_ipc
which takes in arguments instead of relying on argparse.ipc_main
still exists for backwards compatibility.Test Plan
Added a test verifying that
Ran
tox -e py38
to verify tests were running and green.