-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Lint tests #5709
chore: Lint tests #5709
Changes from all commits
ec654b2
00c5444
b6a44e8
74cc70f
6d529e3
84504d3
4b47929
c4a08bd
8cd1134
c416fb8
db5de9b
4b370b9
ba34aa4
968dbc1
2358852
3105a69
273455c
2bf86fa
c41a8cd
6790811
e7d92a1
3fbbfa3
b71f517
4b22b11
54fcb8e
eb5741f
8944632
813b684
cd0e19e
b113c3a
756ae11
14b54e9
24ab9f4
c386c0a
30e99a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,4 +1,74 @@ | ||||
linters-settings: | ||||
revive: | ||||
enable-all-rules: true | ||||
# Do NOT whine about the following, full explanation found in: | ||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#description-of-available-rules | ||||
rules: | ||||
- name: use-any | ||||
disabled: true | ||||
- name: if-return | ||||
disabled: true | ||||
- name: max-public-structs | ||||
disabled: true | ||||
- name: cognitive-complexity | ||||
disabled: true | ||||
- name: argument-limit | ||||
disabled: true | ||||
- name: cyclomatic | ||||
disabled: true | ||||
- name: file-header | ||||
disabled: true | ||||
- name: function-length | ||||
disabled: true | ||||
- name: function-result-limit | ||||
disabled: true | ||||
- name: line-length-limit | ||||
disabled: true | ||||
- name: flag-parameter | ||||
disabled: true | ||||
- name: add-constant | ||||
disabled: true | ||||
- name: empty-lines | ||||
disabled: true | ||||
- name: banned-characters | ||||
disabled: true | ||||
- name: deep-exit | ||||
disabled: true | ||||
- name: confusing-results | ||||
disabled: true | ||||
- name: unused-parameter | ||||
disabled: true | ||||
- name: modifies-value-receiver | ||||
disabled: true | ||||
- name: early-return | ||||
disabled: true | ||||
- name: unnecessary-stmt | ||||
disabled: true | ||||
- name: import-shadowing | ||||
disabled: true | ||||
- name: defer | ||||
disabled: true | ||||
- name: confusing-naming | ||||
disabled: true | ||||
- name: nested-structs | ||||
disabled: true | ||||
- name: unhandled-error | ||||
disabled: true | ||||
# Arguments added below do not trigger the rule. | ||||
# arguments =["os\.(Create|WriteFile|Chmod)", "fmt\.Print", "myFunction", "net\..*", "bytes\.Buffer\.Write"] | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
arguments: | ||||
- 'fmt\..*' | ||||
- 'c.Conn.Close' | ||||
- 'server.Serve' | ||||
- 'http.ListenAndServe' | ||||
- 'conn.Close' | ||||
- 'os.Stderr.Write' | ||||
- 'buf\.(WriteString|Write)' | ||||
- 'csc.Close' | ||||
- 'cl.Close' | ||||
- 'out.WriteRune' | ||||
- 'sb\.(WriteRune|WriteString)' | ||||
- 'reconn.Conn.Close' | ||||
errcheck: | ||||
ignore: fmt:.*,go.uber.org/zap/zapcore:^Add.* | ||||
ignoretests: true | ||||
|
@@ -27,9 +97,12 @@ linters: | |||
- gosimple | ||||
- govet | ||||
- ineffassign | ||||
- nolintlint | ||||
- misspell | ||||
- prealloc | ||||
- revive | ||||
- staticcheck | ||||
- thelper | ||||
- typecheck | ||||
- unconvert | ||||
- unused | ||||
|
@@ -51,7 +124,6 @@ linters: | |||
# - godot | ||||
# - godox | ||||
# - goerr113 | ||||
# - gofumpt | ||||
# - goheader | ||||
# - golint | ||||
# - gomnd | ||||
|
@@ -88,6 +160,8 @@ output: | |||
print-linter-name: true | ||||
|
||||
issues: | ||||
max-issues-per-linter: 0 | ||||
max-same-issues: 0 | ||||
exclude-rules: | ||||
# we aren't calling unknown URL | ||||
- text: 'G107' # G107: Url provided to HTTP request as taint input | ||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -915,7 +915,7 @@ func (h adminHandler) checkOrigin(r *http.Request) (string, error) { | |||
return origin.String(), nil | ||||
} | ||||
|
||||
func (h adminHandler) getOrigin(r *http.Request) (string, *url.URL) { | ||||
func (adminHandler) getOrigin(r *http.Request) (string, *url.URL) { | ||||
origin := r.Header.Get("Origin") | ||||
if origin == "" { | ||||
origin = r.Header.Get("Referer") | ||||
|
@@ -961,9 +961,11 @@ func handleConfig(w http.ResponseWriter, r *http.Request) error { | |||
// Set the ETag as a trailer header. | ||||
// The alternative is to write the config to a buffer, and | ||||
// then hash that. | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the extra line here?
Suggested change
|
||||
w.Header().Set("Trailer", "ETag") | ||||
|
||||
hash := etagHasher() | ||||
|
||||
configWriter := io.MultiWriter(w, hash) | ||||
err := readConfig(r.URL.Path, configWriter) | ||||
if err != nil { | ||||
|
@@ -1022,7 +1024,7 @@ func handleConfig(w http.ResponseWriter, r *http.Request) error { | |||
return nil | ||||
} | ||||
|
||||
func handleConfigID(w http.ResponseWriter, r *http.Request) error { | ||||
func handleConfigID(_ http.ResponseWriter, r *http.Request) error { | ||||
idPath := r.URL.Path | ||||
|
||||
parts := strings.Split(idPath, "/") | ||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -884,11 +884,11 @@ func Version() (simple, full string) { | |||||
if CustomVersion != "" { | ||||||
full = CustomVersion | ||||||
simple = CustomVersion | ||||||
return | ||||||
return full, simple | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is permuting both strings, no?
Suggested change
Not that it matters here, but better be consistent. |
||||||
} | ||||||
full = "unknown" | ||||||
simple = "unknown" | ||||||
return | ||||||
return full, simple | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is permuting both strings, no?
Suggested change
Not that it matters here, but better be consistent. |
||||||
} | ||||||
// find the Caddy module in the dependency list | ||||||
for _, dep := range bi.Deps { | ||||||
|
@@ -968,7 +968,7 @@ func Version() (simple, full string) { | |||||
} | ||||||
} | ||||||
|
||||||
return | ||||||
return simple, full | ||||||
} | ||||||
|
||||||
// ActiveContext returns the currently-active context. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not convinced anybody "whines".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I think they're actually referring to the linter complaining when we don't really care about these things or they aren't relevant in our project. :) Not a person. But yeah, maybe the proposed change here is better.