3 ms·
That would work at file level granularity, but I'd like it to work at line level.
by foreigner 5y ago
That would work at file level granularity, but I'd like it to work at line level.
- masklinn 5y agoYou can usually take the output of the lint tool and filter it by the lines modified by the patch (which you get from the diff). Few tools do it out of the box (in the python world flake8 supports diff filtering out of the box, and there's diff-cover which can filter analysis beyond just test coverage) but it's easy enough to do with a wrapper, especially if the linter has a configurable or even parseable (e.g. json) output option.
- jabo 5y agoFound an ESLint plugin that will only run on staged changes: https://www.npmjs.com/package/eslint-plugin-diff https://www.npmjs.com/package/eslint-plugin-diff