You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently used the new-from-rev key in our configuration to enable revive on our large codebase to avoid having to fix all the errors directly. It was really practical at first !
One major caveat of new-from-rev imo is moving files. Let's say I have a legacy file hello.go with 100 lints (i.e linter errors). The new-from-rev parameter will silence them all. But if I rename this file to hello_world.go or move it to another folder then all the lints will rise again.
$ golangci-lint --versiongolangci-lint has version v1.54.2 built with go1.21.5 from (unknown, mod sum: "h1:oR9zxfWYxt7hFqk6+fw6Enr+E7F0SN2nqHhJYyIb0yo=") on (unknown)
Hey, sorry for the late response I missed the notification !
It feel expected: new-from-rev will use a git diff, so when you move a file, this file is inside the diff.
I agree that this is expected because of the use of git diff, the thing is it's not mentioned anywhere that it's using a git diff, I understood it while playing with it. This is imo what hides the moving-file-trap.
I don't know how to improve the documentation about that 🤔
I think I would expect something like:
Warning: the `--new-from-rev: REV` key works by running a `git diff` between the git revision REV and the current commit.
Renaming / moving a file will hence reveal all the silenced lints in this file.
Welcome
Description of the problem
We recently used the
new-from-rev
key in our configuration to enablerevive
on our large codebase to avoid having to fix all the errors directly. It was really practical at first !One major caveat of
new-from-rev
imo is moving files. Let's say I have a legacy filehello.go
with 100 lints (i.e linter errors). Thenew-from-rev
parameter will silence them all. But if I rename this file tohello_world.go
or move it to another folder then all the lints will rise again.I think this should be mentioned in https://golangci-lint.run/usage/faq/#how-to-integrate-golangci-lint-into-large-project-with-thousands-of-issues to make people aware of the cost of relying on
new-from-rev
.Version of golangci-lint
Configuration
https://github.com/DataDog/datadog-agent/blob/fcb19ce078e7969d285565beec5d374c5fd623e1/.golangci.yml
Go environment
Validation
The text was updated successfully, but these errors were encountered: