Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: group linter implementation and integration tests #4603

Merged
merged 117 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
e1a930e
feat: dynamic parent detection
ldez Mar 25, 2024
00fdfdc
chore: concurrent tests run
ldez Mar 30, 2024
f7e709b
feat: test runner
ldez Mar 25, 2024
157660a
chore: rewrite existing tests
ldez Mar 30, 2024
90a6dba
chore: move nolintlint
ldez Mar 28, 2024
297f186
docs: update new linters page
ldez Apr 1, 2024
d6d543a
chore: groups ginkgolinter files to a package
ldez Apr 1, 2024
f22bd35
chore: groups loggercheck files to a package
ldez Apr 1, 2024
4bb42d6
chore: groups protogetter files to a package
ldez Apr 1, 2024
2264fe3
chore: groups spancheck files to a package
ldez Apr 1, 2024
53e332c
chore: groups zerologlint files to a package
ldez Apr 1, 2024
1b2ced3
chore: groups gomoddirectives files to a package
ldez Apr 1, 2024
646952e
chore: groups mnd files to a package
ldez Apr 1, 2024
a75fb92
chore: groups gocritic files to a package
ldez Apr 1, 2024
a48ba6c
chore: groups gci files to a package
ldez Apr 1, 2024
287ca34
chore: groups godot files to a package
ldez Apr 1, 2024
a1de4d2
chore: groups gofmt files to a package
ldez Apr 1, 2024
55d3408
chore: groups gofumpt files to a package
ldez Apr 1, 2024
b004f4c
chore: groups goheader files to a package
ldez Apr 1, 2024
8a9f76f
chore: groups goimports files to a package
ldez Apr 1, 2024
8f376f7
chore: groups mirror files to a package
ldez Apr 1, 2024
261f2ab
chore: groups misspell files to a package
ldez Apr 1, 2024
eabf783
chore: groups tagalign files to a package
ldez Apr 1, 2024
a2026fa
chore: groups whitespace files to a package
ldez Apr 1, 2024
cd585d9
chore: groups asasalint files to a package
ldez Apr 1, 2024
c618f41
chore: groups asciicheck files to a package
ldez Apr 1, 2024
4f4e453
chore: groups bidichk files to a package
ldez Apr 1, 2024
233f7eb
chore: groups bodyclose files to a package
ldez Apr 1, 2024
dc812b9
chore: groups containedctx files to a package
ldez Apr 1, 2024
9001726
chore: groups contextcheck files to a package
ldez Apr 1, 2024
7e989ab
chore: groups copyloopvar files to a package
ldez Apr 1, 2024
95b6e77
chore: groups cyclop files to a package
ldez Apr 1, 2024
1894902
chore: groups decorder files to a package
ldez Apr 1, 2024
17bd63d
chore: groups depguard files to a package
ldez Apr 1, 2024
b9abd75
chore: groups dogsled files to a package
ldez Apr 1, 2024
88fc2c4
chore: groups dupl files to a package
ldez Apr 1, 2024
f0bf0fd
chore: groups dupword files to a package
ldez Apr 1, 2024
d318c73
chore: groups durationcheck files to a package
ldez Apr 1, 2024
8f79852
chore: groups err113 files to a package
ldez Apr 1, 2024
6befcc8
chore: groups errcheck files to a package
ldez Apr 1, 2024
5bd7e40
chore: groups errchkjson files to a package
ldez Apr 1, 2024
2040f5a
chore: groups errname files to a package
ldez Apr 1, 2024
58d4601
chore: groups errorlint files to a package
ldez Apr 1, 2024
de26591
chore: groups execinquery files to a package
ldez Apr 1, 2024
939b5c8
chore: groups exhaustive files to a package
ldez Apr 1, 2024
c890f8a
chore: groups exhaustruct files to a package
ldez Apr 1, 2024
e4268fb
chore: groups exportloopref files to a package
ldez Apr 1, 2024
12b07b1
chore: groups fatcontext files to a package
ldez Apr 1, 2024
fec4eff
chore: groups forbidigo files to a package
ldez Apr 1, 2024
32cf861
chore: groups forcetypeassert files to a package
ldez Apr 1, 2024
413b7cc
chore: groups funlen files to a package
ldez Apr 1, 2024
8ccebdb
chore: groups gocheckcompilerdirectives files to a package
ldez Apr 1, 2024
3a04f96
chore: groups gochecknoglobals files to a package
ldez Apr 1, 2024
8e1e2dd
chore: groups gochecknoinits files to a package
ldez Apr 1, 2024
438f243
chore: groups gochecksumtype files to a package
ldez Apr 1, 2024
dff0e3e
chore: groups gocognit files to a package
ldez Apr 1, 2024
50c394d
chore: groups goconst files to a package
ldez Apr 1, 2024
e4dbf1f
chore: groups gocyclo files to a package
ldez Apr 1, 2024
fb2e690
chore: groups godox files to a package
ldez Apr 1, 2024
aa6a8a2
chore: groups gomodguard files to a package
ldez Apr 1, 2024
86d30f7
chore: groups goprintffuncname files to a package
ldez Apr 1, 2024
58e4b90
chore: groups gosec files to a package
ldez Apr 1, 2024
f74db20
chore: groups gosimple files to a package
ldez Apr 1, 2024
7bd0222
chore: groups gosmopolitan files to a package
ldez Apr 1, 2024
61749a4
chore: groups govet files to a package
ldez Apr 1, 2024
7d289d6
chore: groups grouper files to a package
ldez Apr 1, 2024
8bb1414
chore: groups importas files to a package
ldez Apr 1, 2024
27923e0
chore: groups inamedparam files to a package
ldez Apr 1, 2024
40dc30e
chore: groups ineffassign files to a package
ldez Apr 1, 2024
ddb7793
chore: groups interfacebloat files to a package
ldez Apr 1, 2024
2022c87
chore: groups intrange files to a package
ldez Apr 1, 2024
2458b2a
chore: groups ireturn files to a package
ldez Apr 1, 2024
5337735
chore: groups lll files to a package
ldez Apr 1, 2024
d7d1d25
chore: groups maintidx files to a package
ldez Apr 1, 2024
6ecf5b6
chore: groups makezero files to a package
ldez Apr 1, 2024
1deaedd
chore: groups musttag files to a package
ldez Apr 1, 2024
7ffb836
chore: groups nakedret files to a package
ldez Apr 1, 2024
37767bd
chore: groups nestif files to a package
ldez Apr 1, 2024
a7d38e9
chore: groups nilerr files to a package
ldez Apr 1, 2024
afe59b3
chore: groups nilnil files to a package
ldez Apr 1, 2024
10fbcea
chore: groups nlreturn files to a package
ldez Apr 1, 2024
ba94a16
chore: groups noctx files to a package
ldez Apr 1, 2024
9f80655
chore: groups nonamedreturns files to a package
ldez Apr 1, 2024
16c53a3
chore: groups nosprintfhostport files to a package
ldez Apr 1, 2024
fb8b08b
chore: groups paralleltest files to a package
ldez Apr 1, 2024
cf0e086
chore: groups perfsprint files to a package
ldez Apr 1, 2024
f32e98e
chore: groups prealloc files to a package
ldez Apr 1, 2024
ae858fd
chore: groups predeclared files to a package
ldez Apr 1, 2024
6bf052a
chore: groups promlinter files to a package
ldez Apr 1, 2024
5e745b0
chore: groups reassign files to a package
ldez Apr 1, 2024
49b338b
chore: groups revive files to a package
ldez Apr 1, 2024
286a32f
chore: groups rowserrcheck files to a package
ldez Apr 1, 2024
20c3e91
chore: groups sloglint files to a package
ldez Apr 1, 2024
fcfe3c7
chore: groups sqlclosecheck files to a package
ldez Apr 1, 2024
1d98b94
chore: groups staticcheck files to a package
ldez Apr 1, 2024
ffbed66
chore: groups stylecheck files to a package
ldez Apr 1, 2024
7f93ec6
chore: groups tagliatelle files to a package
ldez Apr 1, 2024
87d67ca
chore: groups tenv files to a package
ldez Apr 1, 2024
e596db2
chore: groups testableexamples files to a package
ldez Apr 1, 2024
07c1f53
chore: groups testifylint files to a package
ldez Apr 1, 2024
874e3b4
chore: groups testpackage files to a package
ldez Apr 1, 2024
98f82ee
chore: groups thelper files to a package
ldez Apr 1, 2024
0446f66
chore: groups tparallel files to a package
ldez Apr 1, 2024
f8b2fee
chore: groups unconvert files to a package
ldez Apr 1, 2024
781d152
chore: groups unparam files to a package
ldez Apr 1, 2024
d89ed77
chore: groups unused files to a package
ldez Apr 1, 2024
beb1a3a
chore: groups usestdlibvars files to a package
ldez Apr 1, 2024
dc75a5d
chore: groups varnamelen files to a package
ldez Apr 1, 2024
2fd2ed6
chore: groups wastedassign files to a package
ldez Apr 1, 2024
a1aa2bb
chore: groups wrapcheck files to a package
ldez Apr 1, 2024
b170a41
chore: groups wsl files to a package
ldez Apr 1, 2024
b6a5526
chore: update configuration
ldez Mar 30, 2024
aa91418
review
ldez Apr 2, 2024
4f45019
review
ldez Apr 2, 2024
400f3f7
chore: group test_integration and test_integration_fix
ldez Apr 3, 2024
e2d32c1
review
ldez Apr 9, 2024
3928ef5
review
ldez Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: groups unconvert files to a package
ldez committed Apr 8, 2024
commit f8b2fee68a2df851eafd2630cf435d1436bba8d8
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package golinters
package unconvert

import (
"sync"
@@ -12,14 +12,14 @@ import (
"github.com/golangci/golangci-lint/pkg/result"
)

const unconvertName = "unconvert"
const name = "unconvert"

func NewUnconvert(settings *config.UnconvertSettings) *goanalysis.Linter {
func New(settings *config.UnconvertSettings) *goanalysis.Linter {
var mu sync.Mutex
var resIssues []goanalysis.Issue

analyzer := &analysis.Analyzer{
Name: unconvertName,
Name: name,
Doc: goanalysis.TheOnlyanalyzerDoc,
Run: func(pass *analysis.Pass) (any, error) {
issues := runUnconvert(pass, settings)
@@ -37,7 +37,7 @@ func NewUnconvert(settings *config.UnconvertSettings) *goanalysis.Linter {
}

return goanalysis.NewLinter(
unconvertName,
name,
"Remove unnecessary type conversions",
[]*analysis.Analyzer{analyzer},
nil,
@@ -54,7 +54,7 @@ func runUnconvert(pass *analysis.Pass, settings *config.UnconvertSettings) []goa
issues = append(issues, goanalysis.NewIssue(&result.Issue{
Pos: position,
Text: "unnecessary conversion",
FromLinter: unconvertName,
FromLinter: name,
}, pass))
}

11 changes: 11 additions & 0 deletions pkg/golinters/unconvert/unconvert_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package unconvert

import (
"testing"

"github.com/golangci/golangci-lint/test/testshared/integration"
)

func TestFromTestdata(t *testing.T) {
integration.RunTestdata(t)
}
3 changes: 2 additions & 1 deletion pkg/lint/lintersdb/builder_linter.go
Original file line number Diff line number Diff line change
@@ -99,6 +99,7 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/testpackage"
"github.com/golangci/golangci-lint/pkg/golinters/thelper"
"github.com/golangci/golangci-lint/pkg/golinters/tparallel"
"github.com/golangci/golangci-lint/pkg/golinters/unconvert"
"github.com/golangci/golangci-lint/pkg/golinters/whitespace"
"github.com/golangci/golangci-lint/pkg/golinters/zerologlint"
"github.com/golangci/golangci-lint/pkg/lint/linter"
@@ -748,7 +749,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
WithPresets(linter.PresetBugs).
WithURL(""),

linter.NewConfig(golinters.NewUnconvert(&cfg.LintersSettings.Unconvert)).
linter.NewConfig(unconvert.New(&cfg.LintersSettings.Unconvert)).
WithSince("v1.0.0").
WithLoadForGoAnalysis().
WithPresets(linter.PresetStyle).