Merge pull request #17921 from ivanvc/enable-var-naming-linter-rule

Enable var-naming linter rule
This commit is contained in:
James Blair 2024-05-04 20:14:57 +12:00 committed by GitHub
commit 25367fc7e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -87,9 +87,13 @@ linters-settings: # please keep this alphabetized
- name: error-strings
severity: error
disabled: false
# TODO: enable the following rules
- name: var-naming
disabled: true
disabled: false
arguments:
# The following is the configuration for var-naming rule, the first element is the allow list and the second element is the deny list.
- [] # AllowList: leave it empty to use the default (empty, too). This means that we're not relaxing the rule in any way, i.e. elementId will raise a violation, it should be elementID, refer to the next line to see the list of denied initialisms.
- ["GRPC", "WAL"] # DenyList: Add GRPC and WAL to strict the rule not allowing instances like Wal or Grpc. The default values are located at commonInitialisms, refer to: https://github.com/mgechev/revive/blob/v1.3.7/lint/utils.go#L93-L133.
# TODO: enable the following rules
- name: exported
disabled: true
- name: unexported-return

View File

@ -110,9 +110,9 @@ func processRow(dashboard, tab string, row *apipb.ListRowsResponse_Row, allTests
t.FailureLogs = logs
t.FailureRate = float32(failed) / float32(total)
if t.FailedRuns > 0 {
dashboardUrl := fmt.Sprintf("[%s](https://testgrid.k8s.io/%s#%s)", tab, dashboard, tab)
dashboardURL := fmt.Sprintf("[%s](https://testgrid.k8s.io/%s#%s)", tab, dashboard, tab)
t.IssueBody = fmt.Sprintf("## %s Test: %s \nTest failed %.1f%% (%d/%d) of the time\n\nfailure logs are:\n| commit | started | log |\n| --- | --- | --- |\n%s\n",
dashboardUrl, t.FullName, t.FailureRate*100, t.FailedRuns, t.TotalRuns, strings.Join(t.FailureLogs, "\n"))
dashboardURL, t.FullName, t.FailureRate*100, t.FailedRuns, t.TotalRuns, strings.Join(t.FailureLogs, "\n"))
t.IssueBody += "\nPlease follow the [instructions in the contributing guide](https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#check-for-flaky-tests) to reproduce the issue.\n"
fmt.Printf("%s failed %.1f%% (%d/%d) of the time\n", t.FullName, t.FailureRate*100, t.FailedRuns, t.TotalRuns)
}