Skip to content

Commit 2bc5e47

Browse files
committed
[PLUTO-1396] consistent error log
1 parent 235225c commit 2bc5e47

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

tools/pmdRunner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package tools
22

33
import (
44
"codacy/cli-v2/config"
5+
"fmt"
56
"os"
67
"os/exec"
78
"strings"
@@ -56,7 +57,7 @@ func RunPmd(repositoryToAnalyseDirectory string, pmdBinary string, pathsToCheck
5657
// Exit code 4 means violations found – treat as success
5758
return nil
5859
}
59-
return err
60+
return fmt.Errorf("failed to run PMD: %w", err)
6061
}
6162
return nil
6263
}

tools/pylintRunner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func RunPylint(workDirectory string, toolInfo *plugins.ToolInfo, files []string,
5959
// Pylint returns non-zero exit code when it finds issues
6060
// We should not treat this as an error
6161
if _, ok := err.(*exec.ExitError); !ok {
62-
return fmt.Errorf("failed to run pylint: %w", err)
62+
return fmt.Errorf("failed to run Pylint: %w", err)
6363
}
6464
}
6565

tools/trivyRunner.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package tools
22

33
import (
44
"codacy/cli-v2/config"
5+
"fmt"
56
"os"
67
"os/exec"
78
)
@@ -35,5 +36,9 @@ func RunTrivy(repositoryToAnalyseDirectory string, trivyBinary string, pathsToCh
3536
cmd.Stderr = os.Stderr
3637
cmd.Stdout = os.Stdout
3738

38-
return cmd.Run()
39+
err := cmd.Run()
40+
if err != nil {
41+
return fmt.Errorf("failed to run Trivy: %w", err)
42+
}
43+
return nil
3944
}

0 commit comments

Comments
 (0)