Skip to content

Commit

Permalink
Remove duplicate code for argument parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jendrikseipp committed Sep 11, 2020
1 parent 0241a0f commit 59abf28
Showing 1 changed file with 0 additions and 63 deletions.
63 changes: 0 additions & 63 deletions vulture/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import argparse
import ast
from fnmatch import fnmatch, fnmatchcase
import os.path
Expand Down Expand Up @@ -676,68 +675,6 @@ def generic_visit(self, node):
self.visit(value)


def _parse_args():
def csv(exclude):
return exclude.split(",")

usage = "%(prog)s [options] PATH [PATH ...]"
version = f"vulture {__version__}"
glob_help = "Patterns may contain glob wildcards (*, ?, [abc], [!abc])."
parser = argparse.ArgumentParser(prog="vulture", usage=usage)
parser.add_argument(
"paths",
nargs="+",
metavar="PATH",
help="Paths may be Python files or directories. For each directory"
" Vulture analyzes all contained *.py files.",
)
parser.add_argument(
"--exclude",
metavar="PATTERNS",
type=csv,
help=f"Comma-separated list of paths to ignore (e.g.,"
f' "*settings.py,docs/*.py"). {glob_help} A PATTERN without glob'
f" wildcards is treated as *PATTERN*.",
)
parser.add_argument(
"--ignore-decorators",
metavar="PATTERNS",
type=csv,
help=f"Comma-separated list of decorators. Functions and classes using"
f' these decorators are ignored (e.g., "@app.route,@require_*").'
f" {glob_help}",
)
parser.add_argument(
"--ignore-names",
metavar="PATTERNS",
type=csv,
default=None,
help=f'Comma-separated list of names to ignore (e.g., "visit_*,do_*").'
f" {glob_help}",
)
parser.add_argument(
"--make-whitelist",
action="store_true",
help="Report unused code in a format that can be added to a"
" whitelist module.",
)
parser.add_argument(
"--min-confidence",
type=int,
default=0,
help="Minimum confidence (between 0 and 100) for code to be"
" reported as unused.",
)
parser.add_argument(
"--sort-by-size",
action="store_true",
help="Sort unused functions and classes by their lines of code.",
)
parser.add_argument("-v", "--verbose", action="store_true")
parser.add_argument("--version", action="version", version=version)
return parser.parse_args()


def main():
config = make_config()
vulture = Vulture(
Expand Down

0 comments on commit 59abf28

Please sign in to comment.