Skip to content

Commit f2c566b

Browse files
authored
docs: add skip-dirs-use-default into .golangci.example.yml (#820)
1 parent 22df2d7 commit f2c566b

File tree

2 files changed

+82
-75
lines changed

2 files changed

+82
-75
lines changed

.golangci.example.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ run:
1919
build-tags:
2020
- mytag
2121

22-
# which dirs to skip: they won't be analyzed;
22+
# which dirs to skip: issues from them won't be reported;
2323
# can use regexp here: generated.*, regexp is applied on full path;
24-
# default value is empty list, but next dirs are always skipped independently
25-
# from this option's value:
26-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
24+
# default value is empty list, but default dirs are skipped independently
25+
# from this option's value (see skip-dirs-use-default).
2726
skip-dirs:
2827
- src/external_libs
2928
- autogenerated_by_my_lib
3029

30+
# default is true. Enables skipping of directories:
31+
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
32+
skip-dirs-use-default: true
33+
3134
# which files to skip: they will be analyzed, but issues from them
3235
# won't be reported. Default value is empty list, but there is
3336
# no need to include all autogenerated files, we confidently recognize

README.md

Lines changed: 75 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -500,73 +500,74 @@ Usage:
500500
golangci-lint run [flags]
501501
502502
Flags:
503-
--out-format string Format of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml (default "colored-line-number")
504-
--print-issued-lines Print lines of code with issue (default true)
505-
--print-linter-name Print linter name in issue line (default true)
506-
--issues-exit-code int Exit code when issues were found (default 1)
507-
--build-tags strings Build tags
508-
--timeout duration Timeout for total work (default 1m0s)
509-
--tests Analyze tests (*_test.go) (default true)
510-
--print-resources-usage Print avg and max memory usage of golangci-lint and total time
511-
-c, --config PATH Read config from file path PATH
512-
--no-config Don't read config
513-
--skip-dirs strings Regexps of directories to skip
514-
--skip-dirs-use-default Use or not use default excluded directories:
515-
- (^|/)vendor($|/)
516-
- (^|/)third_party($|/)
517-
- (^|/)testdata($|/)
518-
- (^|/)examples($|/)
519-
- (^|/)Godeps($|/)
520-
- (^|/)builtin($|/)
521-
(default true)
522-
--skip-files strings Regexps of files to skip
523-
-E, --enable strings Enable specific linter
524-
-D, --disable strings Disable specific linter
525-
--disable-all Disable all linters
526-
-p, --presets strings Enable presets (bugs|complexity|format|performance|style|unused) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all
527-
--fast Run only fast linters from enabled linters set (first run won't be fast)
528-
-e, --exclude strings Exclude issue by regexp
529-
--exclude-use-default Use or not use default excludes:
530-
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
531-
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
532-
533-
# golint: Annoying issue about not having a comment. The rare codebase has such comments
534-
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
535-
536-
# golint: False positive when tests are defined in package 'test'
537-
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
538-
539-
# govet: Common false positives
540-
- (possible misuse of unsafe.Pointer|should have signature)
541-
542-
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
543-
- ineffective break statement. Did you mean to break out of the outer loop
544-
545-
# gosec: Too many false-positives on 'unsafe' usage
546-
- Use of unsafe calls should be audited
547-
548-
# gosec: Too many false-positives for parametrized shell calls
549-
- Subprocess launch(ed with variable|ing should be audited)
550-
551-
# gosec: Duplicated errcheck checks
552-
- G104
553-
554-
# gosec: Too many issues in popular repos
555-
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
556-
557-
# gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
558-
- Potential file inclusion via variable
559-
(default true)
560-
--max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)
561-
--max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)
562-
-n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.
563-
It's a super-useful option for integration of golangci-lint into existing large codebase.
564-
It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.
565-
For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.
566-
--new-from-rev REV Show only new issues created after git revision REV
567-
--new-from-patch PATH Show only new issues created in git patch with file path PATH
568-
--fix Fix found issues (if it's supported by the linter)
569-
-h, --help help for run
503+
--out-format string Format of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml (default "colored-line-number")
504+
--print-issued-lines Print lines of code with issue (default true)
505+
--print-linter-name Print linter name in issue line (default true)
506+
--modules-download-mode string Modules download mode. If not empty, passed as -mod=<mode> to go tools
507+
--issues-exit-code int Exit code when issues were found (default 1)
508+
--build-tags strings Build tags
509+
--timeout duration Timeout for total work (default 1m0s)
510+
--tests Analyze tests (*_test.go) (default true)
511+
--print-resources-usage Print avg and max memory usage of golangci-lint and total time
512+
-c, --config PATH Read config from file path PATH
513+
--no-config Don't read config
514+
--skip-dirs strings Regexps of directories to skip
515+
--skip-dirs-use-default Use or not use default excluded directories:
516+
- (^|/)vendor($|/)
517+
- (^|/)third_party($|/)
518+
- (^|/)testdata($|/)
519+
- (^|/)examples($|/)
520+
- (^|/)Godeps($|/)
521+
- (^|/)builtin($|/)
522+
(default true)
523+
--skip-files strings Regexps of files to skip
524+
-E, --enable strings Enable specific linter
525+
-D, --disable strings Disable specific linter
526+
--disable-all Disable all linters
527+
-p, --presets strings Enable presets (bugs|complexity|format|performance|style|unused) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all
528+
--fast Run only fast linters from enabled linters set (first run won't be fast)
529+
-e, --exclude strings Exclude issue by regexp
530+
--exclude-use-default Use or not use default excludes:
531+
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
532+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
533+
534+
# golint: Annoying issue about not having a comment. The rare codebase has such comments
535+
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
536+
537+
# golint: False positive when tests are defined in package 'test'
538+
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
539+
540+
# govet: Common false positives
541+
- (possible misuse of unsafe.Pointer|should have signature)
542+
543+
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
544+
- ineffective break statement. Did you mean to break out of the outer loop
545+
546+
# gosec: Too many false-positives on 'unsafe' usage
547+
- Use of unsafe calls should be audited
548+
549+
# gosec: Too many false-positives for parametrized shell calls
550+
- Subprocess launch(ed with variable|ing should be audited)
551+
552+
# gosec: Duplicated errcheck checks
553+
- G104
554+
555+
# gosec: Too many issues in popular repos
556+
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
557+
558+
# gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
559+
- Potential file inclusion via variable
560+
(default true)
561+
--max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)
562+
--max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)
563+
-n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.
564+
It's a super-useful option for integration of golangci-lint into existing large codebase.
565+
It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.
566+
For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.
567+
--new-from-rev REV Show only new issues created after git revision REV
568+
--new-from-patch PATH Show only new issues created in git patch with file path PATH
569+
--fix Fix found issues (if it's supported by the linter)
570+
-h, --help help for run
570571
571572
Global Flags:
572573
--color string Use color when printing; can be 'always', 'auto', or 'never' (default "auto")
@@ -618,15 +619,18 @@ run:
618619
build-tags:
619620
- mytag
620621
621-
# which dirs to skip: they won't be analyzed;
622+
# which dirs to skip: issues from them won't be reported;
622623
# can use regexp here: generated.*, regexp is applied on full path;
623-
# default value is empty list, but next dirs are always skipped independently
624-
# from this option's value:
625-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
624+
# default value is empty list, but default dirs are skipped independently
625+
# from this option's value (see skip-dirs-use-default).
626626
skip-dirs:
627627
- src/external_libs
628628
- autogenerated_by_my_lib
629629
630+
# default is true. Enables skipping of directories:
631+
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
632+
skip-dirs-use-default: true
633+
630634
# which files to skip: they will be analyzed, but issues from them
631635
# won't be reported. Default value is empty list, but there is
632636
# no need to include all autogenerated files, we confidently recognize

0 commit comments

Comments
 (0)