-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Add funcorder linter #5630
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
Merged
Merged
Add funcorder linter #5630
Changes from 10 commits
Commits
Show all changes
30 commits Select commit Hold shift + click to select a range
033e7be adding gofuncor linter
manuelarte d01e5ac Merge branch 'golangci:main' into gofuncor
manuelarte b89e1bd newlinter: Adding gofuncor linter
manuelarte 59190f5 newlinter: updating .golangci.next.reference.yml
manuelarte 74ca9fe newlinter: updating to next minor version
manuelarte 9b578c6 Merge branch 'main' into gofuncor
manuelarte 1bf0125 newlinter: fixing the last checks
manuelarte 47e23e5 newlinter: applying reviewer's comments
manuelarte 03984f5 Merge branch 'main' into gofuncor
manuelarte 455d8ee newlinter: fixing lint
manuelarte 5d1fb67 newlinter: adding gofuncor integration test
manuelarte 944a3f6 newlinter: adding gofuncor integration test
manuelarte 778ccb6 Merge branch 'main' into gofuncor
manuelarte 79d5f8f newlinter: applying comments
manuelarte 84a4968 newlinter: using new release v0.1.1
manuelarte 4c6bfa3 newlinter: renaming gofuncor to funcorder
manuelarte 304d72b Merge branch 'golangci:main' into gofuncor
manuelarte 59de295 newlinter: adding funcorder settings
manuelarte 26c7b00 newlinter: using settings exported constants
manuelarte 616d824 newlinter: fmt
manuelarte a427d22 newlinter: fixing settings check
manuelarte b08537c Merge branch 'main' into gofuncor
manuelarte 6603c25 adding final '.' at the end of the comments
manuelarte 7e61de8 Merge branch 'main' into gofuncor
manuelarte 51efe46 Merge branch 'main' into gofuncor
manuelarte e23677e Merge branch 'main' into gofuncor
ldez ba56a63 review: update JSONSchema
ldez 3a48f33 review
ldez bf7892b review
ldez d0db109 review
ldez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package gofuncor | ||
| | ||
| import ( | ||
| "github.com/manuelarte/gofuncor/pkg/analyzer" | ||
| "golang.org/x/tools/go/analysis" | ||
| | ||
| "github.com/golangci/golangci-lint/v2/pkg/goanalysis" | ||
| ) | ||
| | ||
| func New() *goanalysis.Linter { | ||
| a := analyzer.NewAnalyzer() | ||
| | ||
| return goanalysis.NewLinter( | ||
| a.Name, | ||
| a.Doc, | ||
| []*analysis.Analyzer{a}, | ||
| nil, | ||
| ).WithLoadMode(goanalysis.LoadModeSyntax) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package testdata | ||
ldez marked this conversation as resolved. Show resolved Hide resolved | ||
| | ||
| import "time" | ||
| | ||
| type MyStruct struct { | ||
| Name string | ||
| } | ||
| | ||
| func (m MyStruct) lenName() int { // want `unexported method "lenName" for struct "MyStruct" should be placed after the exported method "GetName"` | ||
| return len(m.Name) | ||
| } | ||
| | ||
| func (m MyStruct) GetName() string { | ||
| return m.Name | ||
| } | ||
| | ||
| func (m *MyStruct) SetName(name string) { | ||
| m.Name = name | ||
| } | ||
| | ||
| type MyStruct2 struct { | ||
| Name string | ||
| } | ||
| | ||
| func (m MyStruct2) GetName() string { | ||
| return m.Name | ||
| } | ||
| | ||
| func (m *MyStruct2) SetName(name string) { | ||
| m.Name = name | ||
| } | ||
| | ||
| func NewMyStruct2() *MyStruct2 { // want `constructor \"NewMyStruct2\" for struct \"MyStruct2\" should be placed before struct method \"GetName\"` | ||
alexandear marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| return &MyStruct2{Name: "John"} | ||
| } | ||
| | ||
| func NewTime() time.Time { | ||
| return time.Now() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.