-
-
Notifications
You must be signed in to change notification settings - Fork 1
Handle conflicting --show-artifacts and --no-artifacts flags #21
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -174,6 +174,12 @@ def scan( | |
| include_dotenv=include_dotenv, | ||
| include_artifacts=include_artifacts, | ||
| ) | ||
| if show_artifacts and not include_artifacts: | ||
| typer.echo( | ||
| "Error: --show-artifacts cannot be used together with --no-artifacts.", | ||
| err=True, | ||
| ) | ||
| raise typer.Exit(code=1) | ||
|
Comment on lines
+177
to
+182
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical indentation bug — every The Even if the indentation were accepted, both statements would execute unconditionally — every call to Additionally, the guard fires after 🐛 Proposed fix ) -> None:
"""Scan a filesystem path for Python environments."""
+ if show_artifacts and not include_artifacts:
+ typer.echo(
+ "Error: --show-artifacts cannot be used together with --no-artifacts.",
+ err=True,
+ )
+ raise typer.Exit(code=1)
+
result = _build_scan_result(
path,
depth,
deep=deep,
stale_days=stale_days,
include_dotenv=include_dotenv,
include_artifacts=include_artifacts,
)
- if show_artifacts and not include_artifacts:
- typer.echo(
- "Error: --show-artifacts cannot be used together with --no-artifacts.",
- err=True,
- )
- raise typer.Exit(code=1)🧰 Tools🪛 Ruff (0.15.1)[warning] 178-178: Expected an indented block after (invalid-syntax) 🤖 Prompt for AI Agents |
||
|
|
||
| if json_output: | ||
| typer.echo(json.dumps(to_serializable_dict(result), indent=2)) | ||
|
|
@@ -373,6 +379,13 @@ def clean( | |
| yes=yes, | ||
| ) | ||
|
|
||
| def test_conflicting_artifact_flags_error(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Riyaa-Bajpai move the test to |
||
| result = runner.invoke( | ||
| app, | ||
| ["scan", "--show-artifacts", "--no-artifacts"], | ||
| ) | ||
| assert result.exit_code != 0 | ||
| assert "cannot be used together" in result.output.lower() | ||
|
Comment on lines
+382
to
+388
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Three issues with this test:
🛠️ Proposed fix (move to a test file)In +from typer.testing import CliRunner
+from envoic.cli import app
+
+runner = CliRunner()
+
+
+def test_conflicting_artifact_flags_error():
+ result = runner.invoke(
+ app,
+ ["scan", "--show-artifacts", "--no-artifacts"],
+ )
+ assert result.exit_code != 0
+ assert "cannot be used together" in result.output🤖 Prompt for AI Agents |
||
|
|
||
| def main() -> None: | ||
| """Console-script entrypoint.""" | ||
|
|
||
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.
@Riyaa-Bajpai please intent the statements