Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/scala/codacy/cppcheck/CPPCheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ object CPPCheck extends Tool {
"--error-exitcode=0",
"--inline-suppr",
"--force",
s"-j ${Runtime.getRuntime().availableProcessors()}",
"-j",
// Keep in sync with CPU limits in codacy-tools
// https://github.com/codacy/codacy-tools/blob/61104fe51fd0c3fa54af76a3ec1a2ff409950320/persistence-plugins/src/main/scala/com/codacy/tools/persistenceplugins/docker/cpp/cppcheck/Cppcheck.scala#L23
"3",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Suggestion: Hardcoding the parallelism count to 3 makes the tool less flexible to changes in the execution environment. Consider using an environment variable to allow this value to be tuned without code changes.

Suggested change
"3",
sys.env.getOrElse("CPPCHECK_THREADS", "3"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try this version with reading env variables? Or is this what you referred to in the PR description?

tried reading automatically the values set by Kubernetes but I couldn't make it work

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We needed to set environment variables based on kubernetes from Worker. It's a mess.
It's much easier to maintain this by hand.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine with me then

languageParameter,
"""--template={"patternId":"{id}","file":"{file}","line":"{line}","message":"{message}"}"""
) ++
Expand Down