mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
nolintlint: allow to fix //nolint lines (#1583)
This commit is contained in:
parent
d28c66672e
commit
e1a734e559
10 changed files with 345 additions and 132 deletions
|
@ -291,6 +291,17 @@ func TestNolintUnused(t *testing.T) {
|
|||
ExpectedNoLintLinter: "varcheck",
|
||||
}
|
||||
|
||||
// the issue below is another nolintlint issue that would be generated for the test file
|
||||
nolintlintIssueVarcheckUnusedOK := result.Issue{
|
||||
Pos: token.Position{
|
||||
Filename: fileName,
|
||||
Line: 5,
|
||||
},
|
||||
FromLinter: golinters.NolintlintName,
|
||||
ExpectNoLint: true,
|
||||
ExpectedNoLintLinter: "varcheck",
|
||||
}
|
||||
|
||||
t.Run("when an issue does not occur, it is not removed from the nolintlint issues", func(t *testing.T) {
|
||||
p := createProcessor(t, log, []string{"nolintlint", "varcheck"})
|
||||
defer p.Finish()
|
||||
|
@ -298,6 +309,13 @@ func TestNolintUnused(t *testing.T) {
|
|||
processAssertSame(t, p, nolintlintIssueVarcheck)
|
||||
})
|
||||
|
||||
t.Run("when an issue does not occur but nolintlint is nolinted, it is removed from the nolintlint issues", func(t *testing.T) {
|
||||
p := createProcessor(t, log, []string{"nolintlint", "varcheck"})
|
||||
defer p.Finish()
|
||||
|
||||
processAssertEmpty(t, p, nolintlintIssueVarcheckUnusedOK)
|
||||
})
|
||||
|
||||
t.Run("when an issue occurs, it is removed from the nolintlint issues", func(t *testing.T) {
|
||||
p := createProcessor(t, log, []string{"nolintlint", "varcheck"})
|
||||
defer p.Finish()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue