You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-2Lines changed: 41 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -715,6 +715,39 @@ issues:
715
715
exclude:
716
716
- abcdef
717
717
718
+
# Excluding configuration per-path and per-linter
719
+
exclude-rules:
720
+
# Exclude some linters from running on tests files.
721
+
- path: _test\.go
722
+
linters:
723
+
- gocyclo
724
+
- errcheck
725
+
- dupl
726
+
- gosec
727
+
728
+
# Ease some gocritic warnings on test files.
729
+
- path: _test\.go
730
+
text: "(unnamedResult|exitAfterDefer)"
731
+
linters:
732
+
- gocritic
733
+
734
+
# Exclude known linters from partially hard-vendored code,
735
+
# which is impossible to exclude via "nolint" comments.
736
+
- path: internal/hmac/
737
+
text: "weak cryptographic primitive"
738
+
linters:
739
+
- gosec
740
+
- path: internal/hmac/
741
+
text: "Write\\` is not checked"
742
+
linters:
743
+
- errcheck
744
+
745
+
# Ease linting on benchmarking code.
746
+
- path: cmd/stun-bench/
747
+
linters:
748
+
- gosec
749
+
- errcheck
750
+
718
751
# Independently from option `exclude` we use default exclude patterns,
719
752
# it can be disabled by this option. To list all
720
753
# excluded by default patterns execute `golangci-lint run --help`.
@@ -785,7 +818,6 @@ linters:
785
818
disable:
786
819
- maligned
787
820
- prealloc
788
-
- gosec
789
821
- gochecknoglobals
790
822
791
823
run:
@@ -798,17 +830,24 @@ service:
798
830
golangci-lint-version: 1.13.x # use fixed version to not introduce new linters unexpectedly
799
831
prepare:
800
832
- echo "here I can run custom commands, but no preparation needed"
833
+
834
+
issues:
835
+
exclude-rules:
836
+
- text: "weak cryptographic primitive"
837
+
linters:
838
+
- gosec
801
839
```
802
840
803
841
## False Positives
804
842
805
843
False positives are inevitable, but we did our best to reduce their count. For example, we have a default enabled set of [exclude patterns](#command-line-options). If a false positive occurred you have the following choices:
806
844
807
-
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type.
845
+
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type. Also, you can use `issues.exclude-rules` config option for per-path or per-linter configuration.
808
846
2. Exclude this one issue by using special comment `//nolint[:linter1,linter2,...]` on issued line.
809
847
Comment `//nolint` disables all issues reporting on this line. Comment e.g. `//nolint:govet` disables only govet issues for this line.
810
848
If you would like to completely exclude all issues for some function prepend this comment
811
849
above function:
850
+
3. Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options.
Copy file name to clipboardExpand all lines: README.tmpl.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -407,11 +407,12 @@ than the default and have more strict settings:
407
407
408
408
False positives are inevitable, but we did our best to reduce their count. For example, we have a default enabled set of [exclude patterns](#command-line-options). If a false positive occurred you have the following choices:
409
409
410
-
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type.
410
+
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type. Also, you can use `issues.exclude-rules` config option for per-path or per-linter configuration.
411
411
2. Exclude this one issue by using special comment `//nolint[:linter1,linter2,...]` on issued line.
412
412
Comment `//nolint` disables all issues reporting on this line. Comment e.g. `//nolint:govet` disables only govet issues for this line.
413
413
If you would like to completely exclude all issues for some function prepend this comment
414
414
above function:
415
+
3. Exclude issues in path by `run.skip-dirs`, `run.skip-files` or `issues.exclude-rules` config options.
0 commit comments