fix(cli): return non-zero exit codes on errors#302
Conversation
- format command: return error when files fail to format (was silently returning exit code 0 after printing error messages) - lint command: return error when files have read errors (was only checking violation counts, ignoring file-level errors) - Updated lint test to expect error on non-existent file
|
Claude finished @ajitpratap0's task —— View job Code Review Complete ✅Reviewing PR #302: fix(cli): return non-zero exit codes on errors Analysis SummaryThis PR correctly addresses issue #289 by fixing CLI commands to return proper exit codes on errors. The changes are well-implemented and targeted. Code Quality Assessment✅ Excellent
Detailed Reviewcmd/gosqlx/cmd/format.go
cmd/gosqlx/cmd/lint.go
cmd/gosqlx/cmd/lint_test.go
Potential Issues & Edge Cases
Performance Considerations✅ No Impact: The added logic is O(n) where n is the number of files, which is already being iterated. No performance degradation. Security Assessment✅ No Concerns: Changes only affect exit code behavior, no security implications. Test Coverage✅ Adequate:
Recommendations✅ Ready to Merge - This is a clean, focused fix that:
The implementation correctly distinguishes between different types of errors and handles them appropriately for CI/CD integration. |
|
Consolidated into batch PR #304 |
Fixes #289
Problem
The
formatandlintCLI commands were returning exit code 0 even when errors occurred (e.g., file not found, format failures). This broke CI/CD integration.Fix
FailedFiles > 0after formatting attemptVerification