Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Jan 31, 2024
1 parent 8e68ddb commit f22eb42
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
7 changes: 2 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ linters:
# Prevent naked returns in long functions.
- nakedret
# Make Go code more readable.
- gocritic
# - gocritic
# We don't want hidden global scope, so disallow global variables. You can disable this with
# Check if comments end in a period. This helps prevent incomplete comment lines, such as half-written sentences.
# - godot
Expand All @@ -38,7 +38,7 @@ linters:
# Complain about cognitive complexity of functions.
- gocognit
# Find repeated strings that could be converted into constants.
- goconst
# - goconst
# Complain about unnecessary type conversions.
- unconvert
# Complain about unused parameters. These should be replaced with underscores.
Expand All @@ -52,9 +52,6 @@ linters:
- dupl
# Check for pointers in loops. This is a typical bug source.
- exportloopref
# Enforce a reasonable function length of 60 lines or 40 instructions. In very rare cases you may want to disable
# this with // nolint:funlen if there is absolutely no way to split the function in question.
- funlen
# Prevent dogsledding (mass-ignoring return values). This typically indicates missing error handling.
- dogsled
# Enforce consistent import aliases across all files.
Expand Down
10 changes: 1 addition & 9 deletions internal/cliwrapper/cliwrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func GetPythonPath() (string, error) {
return p, nil
}
return "", fmt.Errorf("errors getting paths for Python3 (%s) and python (%s)",
errP3.Error(), errP.Error())
errP3.Error(), errP.Error()) //nolint:govet // errP3 and errP will not be nil if this line is reached
}

// Test the function PullModule immediately returns an error on
Expand All @@ -36,10 +36,6 @@ func GetPythonPath() (string, error) {
func Test_PullModule_NonexistentGitLocation(t *testing.T) {
testModule := TestModule{
Location: "nonexistent@git+https://github.com/arcalot/nonexistent.git",
StepID: "wait",
Input: map[string]any{
"seconds": 0.1,
},
}

tempdir := "/tmp/pullmodule1"
Expand Down Expand Up @@ -69,10 +65,6 @@ func Test_PullModule_NonexistentGitLocation(t *testing.T) {
func Test_PullModule_ErrorModuleNameFmt(t *testing.T) {
testModule := TestModule{
Location: "git+https://github.com/arcalot/arcaflow-plugin-wait.git@afdc2323805ffe2b37271f3a852a4ce7ac7379e1",
StepID: "wait",
Input: map[string]any{
"seconds": 0.1,
},
}

tempdir := "/tmp/pullmodule2"
Expand Down
2 changes: 1 addition & 1 deletion internal/connector/cli_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (p *CliPlugin) KillAndClean() error {

slurp, err := io.ReadAll(p.stderr)
if err != nil {
return nil
return err
}
p.logger.Debugf("python plugin module stderr: %s", slurp)
return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/connector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func GetPythonPath() (string, error) {
return p, nil
}
return "", fmt.Errorf("errors getting paths for Python3 (%s) and python (%s)",
errP3.Error(), errP.Error())
errP3.Error(), errP.Error()) //nolint:govet // errP3 and errP will not be nil if this line is reached
}

const examplePluginNickname string = "pythonuser"
Expand Down Expand Up @@ -202,7 +202,7 @@ func RandString(n int) string {
var chars = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
b := make([]rune, n)
for i := range b {
b[i] = chars[rand.Intn(len(chars))]
b[i] = chars[rand.Intn(len(chars))] //nolint:gosec // not for a security credential
}
return string(b)
}
Expand Down

0 comments on commit f22eb42

Please sign in to comment.