ale icon indicating copy to clipboard operation
ale copied to clipboard

Enable ALE to lint diffs

Open Hnasar opened this issue 6 years ago • 2 comments

The fix for https://github.com/w0rp/ale/issues/2399 caused a regression.

It's not great that before the fix, ALE would incorrectly lint the index file when using :Gdiff, but it's also not great that ALE doesn't lint the working directory file at all now.

Several times a day for code review I do

vim -p $(git diff --cached --name-only @~) -c "tabdo :Gdiff @~"

to open the previous version of the file, and (until this regression) show if the new version introduces any linting issues.

Since this patch, no errors are shown now until I run diffoff then :ALELint once again.

Sometimes I also do development using the previous version of the diff open, and I would still like to receive linting updates for changes I make to the working directory file.

Perhaps the patch in 9a0ece1ecb4cddf9eebbc5bfa224764c4b5ad670 would be improved by changing ale#ShouldDoNothing to check two things:

  1. If &diff is on
  2. If the file is in the current repository

This would make it so that in a :Gdiff scenario, the temporary index file would not get checked, but the working directory index file would. Does this sound reasonable?

Hnasar avatar Jun 13 '19 13:06 Hnasar

We can add an option to enable linting for diffs, which can be disabled by default.

w0rp avatar Jun 13 '19 19:06 w0rp

I saw this was added to the v4 milestone back in 2023 and it is now also in the v5 milestone, but I opened a PR supporting this functionality in 2020. Can we get that merged?

blobmasterbrian avatar Nov 22 '25 10:11 blobmasterbrian

Here is the associated PR: https://github.com/dense-analysis/ale/pull/3185

blobmasterbrian avatar Dec 14 '25 16:12 blobmasterbrian