.golangci.yml 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. linters-settings:
  2. govet:
  3. check-shadowing: true
  4. misspell:
  5. locale: US
  6. exhaustive:
  7. default-signifies-exhaustive: true
  8. gomodguard:
  9. blocked:
  10. modules:
  11. - github.com/pkg/errors:
  12. recommendations:
  13. - errors
  14. linters:
  15. enable:
  16. - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
  17. - bodyclose # checks whether HTTP response body is closed successfully
  18. - deadcode # Finds unused code
  19. - depguard # Go linter that checks if package imports are in a list of acceptable packages
  20. - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
  21. - dupl # Tool for code clone detection
  22. - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
  23. - exhaustive # check exhaustiveness of enum switch statements
  24. - exportloopref # checks for pointers to enclosing loop variables
  25. - gci # Gci control golang package import order and make it always deterministic.
  26. - gochecknoglobals # Checks that no globals are present in Go code
  27. - gochecknoinits # Checks that no init functions are present in Go code
  28. - gocognit # Computes and checks the cognitive complexity of functions
  29. - goconst # Finds repeated strings that could be replaced by a constant
  30. - gocritic # The most opinionated Go source code linter
  31. - godox # Tool for detection of FIXME, TODO and other comment keywords
  32. - goerr113 # Golang linter to check the errors handling expressions
  33. - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
  34. - gofumpt # Gofumpt checks whether code was gofumpt-ed.
  35. - goheader # Checks is file header matches to pattern
  36. - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports
  37. - golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes
  38. - gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations.
  39. - goprintffuncname # Checks that printf-like functions are named with `f` at the end
  40. - gosec # Inspects source code for security problems
  41. - gosimple # Linter for Go source code that specializes in simplifying a code
  42. - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
  43. - ineffassign # Detects when assignments to existing variables are not used
  44. - misspell # Finds commonly misspelled English words in comments
  45. - nakedret # Finds naked returns in functions greater than a specified function length
  46. - noctx # noctx finds sending http request without context.Context
  47. - scopelint # Scopelint checks for unpinned variables in go programs
  48. - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks
  49. - structcheck # Finds unused struct fields
  50. - stylecheck # Stylecheck is a replacement for golint
  51. - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
  52. - unconvert # Remove unnecessary type conversions
  53. - unparam # Reports unused function parameters
  54. - unused # Checks Go code for unused constants, variables, functions and types
  55. - varcheck # Finds unused global variables and constants
  56. - whitespace # Tool for detection of leading and trailing whitespace
  57. disable:
  58. - funlen # Tool for detection of long functions
  59. - gocyclo # Computes and checks the cyclomatic complexity of functions
  60. - godot # Check if comments end in a period
  61. - gomnd # An analyzer to detect magic numbers.
  62. - lll # Reports long lines
  63. - maligned # Tool to detect Go structs that would take less memory if their fields were sorted
  64. - nestif # Reports deeply nested if statements
  65. - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity
  66. - nolintlint # Reports ill-formed or insufficient nolint directives
  67. - prealloc # Finds slice declarations that could potentially be preallocated
  68. - rowserrcheck # checks whether Err of rows is checked successfully
  69. - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed.
  70. - testpackage # linter that makes you use a separate _test package
  71. - wsl # Whitespace Linter - Forces you to use empty lines!
  72. issues:
  73. exclude-use-default: false
  74. exclude-rules:
  75. # Allow complex tests, better to be self contained
  76. - path: _test\.go
  77. linters:
  78. - gocognit
  79. # Allow complex main function in examples
  80. - path: examples
  81. text: "of func `main` is high"
  82. linters:
  83. - gocognit
  84. run:
  85. skip-dirs-use-default: false