-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix linter golint #2240
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
Fix linter golint #2240
Changes from all commits
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 |
---|---|---|
|
@@ -32,7 +32,7 @@ func NewCmd() *cobra.Command { | |
Short: "Run scorecard tests", | ||
Long: `Runs blackbox scorecard tests on an operator | ||
`, | ||
RunE: scorecard.ScorecardTests, | ||
RunE: scorecard.Tests, | ||
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. I'm fine with this. |
||
} | ||
|
||
scorecardCmd.Flags().String(scorecard.ConfigOpt, "", fmt.Sprintf("config file (default is '<project_dir>/%s'; the config file's extension and format can be .yaml, .json, or .toml)", scorecard.DefaultConfigFile)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,10 +83,10 @@ func ToSnake(s string) string { | |
} | ||
bits := []string{} | ||
n := "" | ||
real_i := -1 | ||
iReal := -1 | ||
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. yep I'm surprised underscore variable compiled. |
||
|
||
for i, v := range s { | ||
real_i += 1 | ||
iReal++ | ||
// treat acronyms as words, eg for JSONData -> JSON is a whole word | ||
nextCaseIsChanged := false | ||
if i+1 < len(s) { | ||
|
@@ -96,22 +96,22 @@ func ToSnake(s string) string { | |
} | ||
} | ||
|
||
if real_i > 0 && n[len(n)-1] != '_' && nextCaseIsChanged { | ||
if iReal > 0 && n[len(n)-1] != '_' && nextCaseIsChanged { | ||
// add underscore if next letter case type is changed | ||
if v >= 'A' && v <= 'Z' { | ||
bits = append(bits, strings.ToLower(n)) | ||
n = string(v) | ||
real_i = 0 | ||
iReal = 0 | ||
} else if v >= 'a' && v <= 'z' { | ||
bits = append(bits, strings.ToLower(n+string(v))) | ||
n = "" | ||
real_i = -1 | ||
iReal = -1 | ||
} | ||
} else if v == ' ' || v == '_' || v == '-' { | ||
// replace spaces/underscores with delimiters | ||
bits = append(bits, strings.ToLower(n)) | ||
n = "" | ||
real_i = -1 | ||
iReal = -1 | ||
} else { | ||
n = n + string(v) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ import ( | |
var _ ScorecardFormatter = &scapiv1alpha1.ScorecardOutput{} | ||
var _ ScorecardFormatter = &scapiv1alpha2.ScorecardOutput{} | ||
|
||
type ScorecardFormatter interface { | ||
type ScorecardFormatter interface { //nolint:golint | ||
// todo(camilamacedo86): The no lint here is for pkg/apis/scorecard/formatting.go:25:6: type name will be used as scorecard.ScorecardFormatter by other packages, and that stutters; consider calling this Formatter (golint) | ||
// However, was decided to not move forward with it now in order to not introduce breakchanges with the task to add the linter. We should to do it after. | ||
Comment on lines
+25
to
+27
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. 👍 |
||
MarshalText() (string, error) | ||
} |
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.
👍