Session 102 tested some native fixers but not all. This session completes the validation of all tier 2 native fixers.
Reference file: /Users/alpinro/CodePrjects/codequal/packages/agents/src/fix-agent/tool-fixers/tier2-executor.ts
Goal: Validate autoflake removes unused imports and variables Steps:
- Create test Python file with unused imports and variables
- Run
autoflake --in-place --remove-all-unused-imports --remove-unused-variables - Verify unused code is removed
- Document which issues autoflake can fix vs what needs AI
Goal: Validate Black formats Python code correctly Steps:
- Create test Python file with formatting issues (long lines, inconsistent quotes, spacing)
- Run
blackon the test file - Verify formatting is corrected
- Document Black's formatting capabilities
Goal: Validate isort organizes Python imports Steps:
- Create test Python file with unorganized imports
- Run
isorton the test file - Verify imports are sorted (stdlib, third-party, local)
- Document isort's sorting behavior
Goal: Validate PyUpgrade modernizes Python syntax Steps:
- Create test Python file with old-style syntax (format strings, type hints)
- Run
pyupgrade --py310-pluson the test file - Verify syntax is modernized (f-strings, modern type hints)
- Document which upgrades PyUpgrade handles
Goal: Install goimports and validate it fixes Go imports Steps:
- Check if goimports is installed, if not document installation:
go install golang.org/x/tools/cmd/goimports@latest - Create test Go file with unused imports and formatting issues
- Run
goimports -won the test file - Verify unused imports removed and formatting fixed
- Compare goimports vs gofmt capabilities
Goal: Install google-java-format and validate Java formatting Steps:
- Check if google-java-format is installed, document installation if needed
- Create test Java file with formatting issues
- Run
google-java-format --replaceon the test file - Verify formatting matches Google Java Style Guide
- Document limitations (formatting only, not semantic fixes)
Goal: Validate Sorald can fix SonarQube violations Steps:
- Check if Sorald is installed
- Create test Java file with common SonarQube violations
- Run
sorald repairon the test file - Document which SonarQube rules Sorald can auto-fix
- Compare Sorald capabilities vs PMD (which has no auto-fix)
Goal: Validate OpenRewrite for Java refactoring Steps:
- Check if OpenRewrite Maven plugin is available
- Document common recipes for security/code quality fixes
- Test a simple recipe on sample Java code
- Document how to integrate OpenRewrite with fix-agent
Goal: Validate clang-format for C/C++ code Steps:
- Check if clang-format is installed
- Create test C++ file with formatting issues
- Run
clang-format -ion the test file - Document formatting capabilities
Goal: Validate clang-tidy auto-fix capabilities Steps:
- Check if clang-tidy is installed
- Create test C++ file with common issues
- Run
clang-tidy --fixon the test file - Document which checks support auto-fix
Goal: Validate dotnet-format for C# code Steps:
- Check if dotnet CLI is installed
- Create test C# file with formatting issues
- Run
dotnet formaton a test project - Document formatting capabilities
Goal: Document all tier 2 fixers with their capabilities Steps:
- Create markdown table with all fixers
- List: tool name, language, what it fixes, what needs AI
- Add installation instructions for each tool
- Add to docs/ for reference
Goal: Add tool availability checks to executors Steps:
- Add
isAvailable()method to ToolExecutorBase if not exists - Implement availability check for each executor
- Return graceful error when tool not installed
- Log installation instructions when tool missing
Goal: Automated tests for native fixer validation Steps:
- Create test file:
packages/agents/src/fix-agent/tool-fixers/__tests__/tier2-executor.test.ts - Add tests for each executor's fix capabilities
- Mock tool execution for CI environments
- Test getRecommendedTier2Fixer() function