Lint Disable Headers
GitAuto automatically adds necessary lint-disable comments to the top of test files. Test files legitimately need certain lint rules disabled (unused variables in mocks, require statements for CommonJS), and without these headers, tests fail linting even when the test code is correct.
Why This Exists
Test files have different linting needs than production code. Mock functions create variables that appear unused. CommonJS require() calls trigger ESLint rules designed for ES modules. Python test fixtures use function arguments that look unused to pylint. Without the correct disable comments at the top of each test file, CI linting fails on code that is structurally correct. The model sometimes adds these headers and sometimes forgets, leading to inconsistent results.
Why Models Don't Add Lint-Disable Comments
Models focus on writing functionally correct code, not on satisfying linter configurations they have never seen. A model does not know that your project's ESLint config flags CommonJS requires or that PHPUnit test files need specific phpcs:disable comments. These are project-specific configuration details that exist outside the model's context. Benchmarks do not run project-specific linters, so a model is never penalized during evaluation for missing lint-disable comments and has no training signal to include them.
How It Works
After generating a test file, GitAuto inspects the file extension and adds the appropriate lint-disable header. The system merges required rules to avoid duplicates:
- TypeScript/JavaScript:
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-var-requires */ - Python:
# pylint: disable=redefined-outer-name,unused-argument - PHP:
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameterplaced after the<?phptag
If the file already has a lint-disable header, the system merges the required rules into the existing header rather than adding a duplicate. For PHP files, the header is placed after the opening <?php tag to maintain valid syntax.
Related Features
- Import Sorting - Sorts imports alphabetically, which lint-disable headers sit above
- Trailing Space Removal - Cleans up whitespace in generated headers
Need Help?
Have questions or suggestions? We're here to help you get the most out of GitAuto.
Contact us with your questions or feedback!