Skip to content

Commit

Permalink
setup: lint config
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Sep 6, 2024
1 parent 16a2d45 commit 0938254
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
run:
tests: false
skip-dirs:
- tests/e2e
- tests/simulation

govet:
# Enable analyzers by name (in addition to default).
# Run `go tool vet help` to see all analyzers.
# Default: []
enable:
- fieldalignment

linters:
enable:
# - dupl
# - nestif
# - rowserrcheck -- enable when it will support generics
# - whitespace
# - wsl
- asciicheck
- bodyclose
# TODO; we need re-enable this linter once golangci-lint or .depguard.yaml is done
# - depguard
- dogsled
- errcheck
- exportloopref
- goconst
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- grouper
- ineffassign
- lll
- misspell
- nakedret
- nolintlint
- prealloc
- revive
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars

issues:
exclude-rules:
- path: _test\.go
linters:
- gosec
- linters:
- lll
source: "https://"
max-same-issues: 50

linters-settings:
dogsled:
max-blank-identifiers: 3
misspell:
locale: US
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
revive:
confidence: 0
severity: error
error-code: 1
warning-code: 0
# List of rules to enable explicitly should be a subset of .revive.toml
# so only critical rules cause CI to fail instead of just generating annotations.
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-block
- name: error-return
- name: error-strings
- name: error-naming
- name: errorf
- name: exported
- name: if-return
- name: increment-decrement
- name: indent-error-flow
- name: range
- name: receiver-naming
# - name: redefines-builtin-id
- name: superfluous-else
- name: time-naming
- name: unexported-return
- name: unreachable-code
# - name: unused-parameter
- name: var-declaration
- name: var-naming
5 changes: 5 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Default state for all rules
default: true
# MD014/commands-show-output Dollar signs used before commands without showing output
MD014: false
MD013: false
66 changes: 66 additions & 0 deletions .revive.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Sets the default severity to "error"
severity = "error"

# Sets the default failure confidence. This means that linting errors
# with less than 0 confidence will be ignored.
confidence = 0

# https://github.com/mgechev/revive#configuration

# Recommended configuration, minus what's commented out
[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.empty-block]
[rule.error-return]
[rule.error-strings]
[rule.error-naming]
[rule.errorf]
#[rule.exported]
[rule.if-return]
[rule.increment-decrement]
[rule.indent-error-flow]
#[rule.package-comments]
[rule.range]
[rule.receiver-naming]
#[rule.redefines-builtin-id]
[rule.superfluous-else]
[rule.time-naming]
[rule.unexported-return]
[rule.unreachable-code]
#[rule.unused-parameter]
[rule.var-declaration]
[rule.var-naming]

# Additional rules
[rule.atomic]
[rule.bool-literal-in-expr]
[rule.constant-logical-expr]
[rule.datarace]
[rule.duplicated-imports]
[rule.early-return]
#[rule.empty-lines]
[rule.get-return]
[rule.identical-branches]
[rule.modifies-value-receiver]
#[rule.optimize-operands-order]
[rule.range-val-address]
[rule.range-val-in-closure]
[rule.string-of-int]
[rule.struct-tag]
[rule.time-equal]
[rule.unconditional-recursion]
#[rule.unexported-naming]
#[rule.unhandled-error]
[rule.unnecessary-stmt]
#[rule.unused-receiver]
#[rule.use-any]
#[rule.useless-break]
[rule.waitgroup-by-value]

# Rules that we might want to enable
#[rule.bare-return]
#[rule.deep-exit]
#[rule.defer]
#[rule.import-shadowing]

0 comments on commit 0938254

Please sign in to comment.