Created
July 28, 2023 12:53
-
-
Save davrux/9aabe281081bc9c9decdf0801c72be7d to your computer and use it in GitHub Desktop.
Golangci Lint
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
# | |
# Standard golangci settings. | |
# | |
# The line-length-limit is disabled by default. Set it to a value appropriate | |
# for your project. When using swagger inline definitions the lines can become | |
# long. | |
# | |
# Look for gosec settings. Check if TLS and an unsecure rand generator is | |
# appropriate for your project. Never allow G404 for cryptographic input! G402 | |
# must be used with caution. | |
issues: | |
exclude-use-default: false | |
exclude: | |
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok | |
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked | |
# EXC0003 golint: False positive when tests are defined in package 'test' | |
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this | |
# EXC0004 govet: Common false positives | |
- (possible misuse of unsafe.Pointer|should have signature) | |
# EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore | |
- ineffective break statement. Did you mean to break out of the outer loop | |
# EXC0006 gosec: Too many false-positives on 'unsafe' usage | |
- Use of unsafe calls should be audited | |
# EXC0007 gosec: Too many false-positives for parametrized shell calls | |
- Subprocess launch(ed with variable|ing should be audited) | |
# EXC0008 gosec: Duplicated errcheck checks | |
- (G104|G307) | |
# EXC0009 gosec: Too many issues in popular repos | |
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less) | |
# EXC0010 gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)' | |
- Potential file inclusion via variable | |
# EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments | |
- exported (.+) should have comment( \(or a comment on this block\))? or be unexported | |
linters: | |
enable: | |
- revive | |
- gosec | |
- godot | |
- zerologlint | |
linters-settings: | |
gosec: | |
exclude-generated: true | |
excludes: | |
- G402 # Look for bad TLS connection settings (Depends on project!) | |
- G404 # Insecure random number source (rand) (Depends on project!) | |
godot: | |
scope: toplevel | |
exclude: | |
- "^todo:" | |
- "^fixme:" | |
- "^ @m4" | |
- "//" | |
errcheck: | |
exclude-functions: | |
- (*github.com/allgeierit/go-mg.Store).Delete | |
- (*github.com/allgeierit/go-mg.Store).SoftDelete | |
- (*github.com/allgeierit/go-mg.Store).DeleteAll | |
- (*github.com/allgeierit/go-mgmail.Store).DeleteAll | |
- (*github.com/allgeierit/go-emily/mail.Generator).Cleanup | |
revive: | |
ignore-generated-header: true | |
enable-all-rules: true | |
rules: | |
- name: banned-characters | |
severity: warning | |
disabled: false | |
arguments: ["Ω", "Σ", "σ"] | |
- name: function-result-limit | |
severity: warning | |
disabled: false | |
arguments: [4] | |
- name: function-length | |
severity: warning | |
disabled: false | |
arguments: [80, 120] | |
- name: line-length-limit | |
severity: warning | |
disabled: true | |
arguments: [120] | |
- name: cyclomatic | |
severity: warning | |
disabled: true | |
arguments: [3] | |
- name: cognitive-complexity | |
severity: warning | |
disabled: false | |
arguments: [20] | |
- name: argument-limit | |
severity: warning | |
disabled: false | |
arguments: [6] | |
- name: file-header | |
severity: warning | |
disabled: true | |
- name: max-public-structs | |
severity: warning | |
disabled: true | |
arguments: [3] | |
- name: add-constant | |
severity: warning | |
disabled: true | |
arguments: | |
- maxLitCount: "3" | |
allowStrs: '""' | |
allowInts: "0,1,2" | |
allowFloats: "0.0,0.,1.0,1.,2.0,2." | |
# done by other checkers | |
- name: unhandled-error | |
severity: warning | |
disabled: true | |
arguments: | |
- "fmt.Printf" | |
- "myFunction" | |
- name: comment-spacings | |
severity: warning | |
disabled: true | |
- name: package-comments | |
severity: warning | |
disabled: false | |
- name: flag-parameter | |
severity: warning | |
disabled: true | |
- name: exported | |
severity: warning | |
disabled: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment