File tree Expand file tree Collapse file tree 4 files changed +19
-29
lines changed
Expand file tree Collapse file tree 4 files changed +19
-29
lines changed Original file line number Diff line number Diff line change @@ -3,19 +3,14 @@ version: "2"
33linters :
44 default : all
55 disable :
6- - testableexamples
76 - errcheck
8- - exptostd
9- - forbidigo
107 - forcetypeassert
11- - gocritic
128 - promlinter
139 - embeddedstructfieldcheck
1410 - funcorder
1511 - noinlineerr
1612 - wsl_v5
1713
18-
1914 #
2015 # Redundant
2116 #
@@ -76,16 +71,16 @@ linters:
7671 desc : yaml.v2 is deprecated for new code in favor of yaml.v3
7772
7873 errcheck :
79- # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
80- # Such cases aren't reported by default.
8174 check-type-assertions : false
82- # List of functions to exclude from checking, where each entry is a single function to exclude.
83- # See https://github.com/kisielk/errcheck#excluding-functions for details.
8475
8576 gocritic :
8677 enable-all : true
8778 disabled-checks :
79+ - appendCombine
80+ - hugeParam
81+ - importShadow
8882 - paramTypeCombine
83+ - whyNoLint
8984
9085 govet :
9186 disable :
@@ -115,8 +110,6 @@ linters:
115110 - 33
116111 - name : comment-spacings
117112 disabled : true
118- # - name: confusing-results
119- # disabled: true
120113 - name : cyclomatic
121114 arguments :
122115 # lower this after refactoring
@@ -142,8 +135,6 @@ linters:
142135 disabled : true
143136 - name : package-comments
144137 disabled : true
145- - name : var-naming
146- disabled : true
147138 - name : unchecked-type-assertion
148139 disabled : true
149140 - name : useless-break
@@ -153,10 +144,6 @@ linters:
153144 checks :
154145 - all
155146
156- wsl :
157- # Allow blocks to end with comments
158- allow-trailing-comment : true
159-
160147 exclusions :
161148 presets :
162149 - comments
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ func Execute() error {
5656 flag .Parse ()
5757
5858 if * bouncerVersion {
59- fmt .Printf ( "%s" , version .FullString ())
59+ fmt .Fprintf ( os . Stdout , "%s" , version .FullString ())
6060 return nil
6161 }
6262
@@ -70,7 +70,7 @@ func Execute() error {
7070 }
7171
7272 if * showConfig {
73- fmt .Println ( string (configBytes ))
73+ fmt .Fprintln ( os . Stdout , string (configBytes ))
7474 return nil
7575 }
7676
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ const lowerhex = "0123456789abcdef"
119119func appendQuoted (buf []byte , s string ) []byte {
120120 var runeTmp [utf8 .UTFMax ]byte
121121 //nolint:wastedassign
122- for width := 0 ; len ( s ) > 0 ; s = s [width :] {
122+ for width := 0 ; s != "" ; s = s [width :] {
123123 r := rune (s [0 ])
124124 width = 1
125125
Original file line number Diff line number Diff line change @@ -49,20 +49,23 @@ msg() {
4949}
5050
5151require () {
52- set | grep -q " ^$1 =" || { msg err " missing required variable \$ $1 " ; exit 1; }
52+ set | grep -q " ^$1 =" || {
53+ msg err " missing required variable \$ $1 "
54+ exit 1
55+ }
5356 shift
5457 [ " $# " -eq 0 ] || require " $@ "
5558}
5659
5760# shellcheck disable=SC2034
5861{
59- SERVICE=" $BOUNCER .service"
60- BIN_PATH_INSTALLED=" /usr/local/bin/$BOUNCER "
61- BIN_PATH=" ./$BOUNCER "
62- CONFIG_DIR=" /etc/crowdsec/bouncers"
63- CONFIG_FILE=" $BOUNCER .yaml"
64- CONFIG=" $CONFIG_DIR /$CONFIG_FILE "
65- SYSTEMD_PATH_FILE=" /etc/systemd/system/$SERVICE "
62+ SERVICE=" $BOUNCER .service"
63+ BIN_PATH_INSTALLED=" /usr/local/bin/$BOUNCER "
64+ BIN_PATH=" ./$BOUNCER "
65+ CONFIG_DIR=" /etc/crowdsec/bouncers"
66+ CONFIG_FILE=" $BOUNCER .yaml"
67+ CONFIG=" $CONFIG_DIR /$CONFIG_FILE "
68+ SYSTEMD_PATH_FILE=" /etc/systemd/system/$SERVICE "
6669}
6770
6871assert_root () {
@@ -141,7 +144,7 @@ set_api_key() {
141144 ret=1
142145 else
143146 echo " API Key successfully created" >&2
144- echo " $bouncer_id " > " $CONFIG .id"
147+ echo " $bouncer_id " > " $CONFIG .id"
145148 fi
146149 else
147150 echo " cscli/crowdsec is not present, please set the API key manually" >&2
You can’t perform that action at this time.
0 commit comments