Skip to content
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

Add --config parameter to specify pyproject.toml path #352

Merged
merged 12 commits into from
Mar 19, 2024
9 changes: 8 additions & 1 deletion vulture/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#: Possible configuration options and their respective defaults
DEFAULTS = {
"config": "pyproject.toml",
"min_confidence": 0,
"paths": [],
"exclude": [],
Expand Down Expand Up @@ -158,6 +159,12 @@ def csv(exclude):
default=missing,
help="Sort unused functions and classes by their lines of code.",
)
parser.add_argument(
"-c", "--config",
glenrobertson marked this conversation as resolved.
Show resolved Hide resolved
type=str,
default="pyproject.toml",
help="Path to pyproject.toml config file",
glenrobertson marked this conversation as resolved.
Show resolved Hide resolved
)
parser.add_argument(
"-v", "--verbose", action="store_true", default=missing
)
Expand Down Expand Up @@ -195,7 +202,7 @@ def make_config(argv=None, tomlfile=None):
config = _parse_toml(tomlfile)
detected_toml_path = str(tomlfile)
else:
toml_path = pathlib.Path("pyproject.toml").resolve()
toml_path = pathlib.Path(cli_config["config"]).resolve()
if toml_path.is_file():
with open(toml_path, "rb") as fconfig:
config = _parse_toml(fconfig)
Expand Down
Loading