Fix: reject fix flags with JSON/SARIF output#138
Conversation
Summary of ChangesHello @avifenesh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the command-line interface by introducing a validation rule that prevents the use of automated fixing flags with structured output formats like JSON and SARIF. This change ensures that users receive clear error messages when attempting to combine these incompatible options, thereby improving the robustness and user experience of the tool. It also includes comprehensive test coverage and updated documentation to reflect this new behavior. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly implements a restriction to prevent the use of fix-related flags (--fix, --dry-run, --fix-safe) with machine-readable output formats (json, sarif). The implementation is clean, using an early return in validate_command to reject invalid flag combinations. The change is accompanied by a good refactoring that removes a redundant variable definition. The addition of comprehensive integration tests ensures the new restriction is well-covered, and the update to the README.md clearly documents this new limitation for users. Overall, this is a high-quality contribution that improves the tool's robustness and user experience.
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #128 where fix flags (--fix, --dry-run, --fix-safe) were silently ignored when used with JSON or SARIF output formats. The fix adds early validation to explicitly reject these incompatible flag combinations with a clear error message.
Changes:
- Added validation logic to reject fix flags when used with non-text output formats
- Added comprehensive test coverage for all rejected flag combinations (6 scenarios)
- Refactored existing test to use new shared helper function
- Updated README documentation to clarify that fix flags only work with text output
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/agnix-cli/src/main.rs | Moved should_fix calculation earlier and added validation to reject fix flags with JSON/SARIF formats before processing |
| crates/agnix-cli/tests/cli_integration.rs | Added helper function and comprehensive test covering all 6 flag combinations (2 formats × 3 flags), refactored existing test |
| README.md | Added documentation notes in both JSON and SARIF output format sections clarifying fix flag restrictions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
1 similar comment
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Summary
Test Plan
Related Issues
Closes #128