forked from oxsecurity/megalinter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
golangci-lint: add capability to autofix (oxsecurity#2700)
* golangci-lint: add capability to fix * Change default golangci config * [MegaLinter] Apply linters fixes * Change test case * Fix go auto-fix tests --------- Co-authored-by: nvuillam <[email protected]> Co-authored-by: nvuillam <[email protected]>
- Loading branch information
Showing
6 changed files
with
37 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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,9 @@ | ||
// This is a package comment | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("hello world") | ||
nicolas() | ||
} |
This file contains 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,8 @@ | ||
// This is a package comment | ||
package main | ||
|
||
import "fmt" | ||
|
||
func nicolas() { | ||
fmt.Println("hello world") | ||
} |
This file contains 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 |
---|---|---|
@@ -1,40 +1,11 @@ | ||
--- | ||
######################### | ||
######################### | ||
## Golang Linter rules ## | ||
######################### | ||
######################### | ||
|
||
# configure golangci-lint | ||
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml | ||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- dupl | ||
- gosec | ||
- goconst | ||
linters: | ||
disable-all: true | ||
enable: | ||
- golint | ||
- gosec | ||
- unconvert | ||
- gocyclo | ||
- goconst | ||
- goimports | ||
- maligned | ||
- gofmt | ||
- gocritic | ||
linters-settings: | ||
errcheck: | ||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; | ||
# default is false: such cases aren't reported by default. | ||
check-blank: true | ||
govet: | ||
# report about shadowed variables | ||
check-shadowing: true | ||
gocyclo: | ||
# minimal code complexity to report, 30 by default | ||
min-complexity: 15 | ||
maligned: | ||
# print struct with more effective memory layout or not, false by default | ||
suggest-new: true | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- typecheck | ||
- unused |
This file contains 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 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 |
---|---|---|
@@ -1,40 +1,11 @@ | ||
--- | ||
######################### | ||
######################### | ||
## Golang Linter rules ## | ||
######################### | ||
######################### | ||
|
||
# configure golangci-lint | ||
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml | ||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- dupl | ||
- gosec | ||
- goconst | ||
linters: | ||
disable-all: true | ||
enable: | ||
- golint | ||
- gosec | ||
- unconvert | ||
- gocyclo | ||
- goconst | ||
- goimports | ||
- maligned | ||
- gofmt | ||
- gocritic | ||
linters-settings: | ||
errcheck: | ||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; | ||
# default is false: such cases aren't reported by default. | ||
check-blank: true | ||
govet: | ||
# report about shadowed variables | ||
check-shadowing: true | ||
gocyclo: | ||
# minimal code complexity to report, 30 by default | ||
min-complexity: 15 | ||
maligned: | ||
# print struct with more effective memory layout or not, false by default | ||
suggest-new: true | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- typecheck | ||
- unused |
This file contains 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