Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM golang:1.15.15-alpine3.14 as builder
RUN apk add --no-cache git
RUN go get -u gitlab.com/opennota/check/cmd/aligncheck

FROM amazoncorretto:8-alpine3.14-jre
FROM amazoncorretto:8-alpine3.21-jre

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

The multi-stage build uses Alpine 3.14 for the builder stage (Line 1) and Alpine 3.21 for the runtime stage (Line 6). Mixing these versions when copying system-dependent components like the Go toolchain and the aligncheck binary is risky because of potential ABI incompatibilities or changed library paths in musl across major Alpine releases. This can cause the tool to fail at runtime when resolving symbols or executing Go commands.

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

The runtime image has been updated to Alpine 3.21, but the builder stage still uses Alpine 3.14. This version mismatch between stages can cause stability issues or runtime crashes because the Go binaries were compiled against an older version of musl. The builder stage should be updated to use a matching Alpine 3.21 image.


RUN apk add bash

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name := "codacy-aligncheck"
scalaVersion := "2.12.12"

libraryDependencies ++= Seq(
"com.codacy" %% "codacy-engine-scala-seed" % "5.0.2",
"com.codacy" %% "codacy-engine-scala-seed" % "6.1.4",
"com.github.pathikrit" %% "better-files" % "3.9.1"
).map(_.withSources())

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.4.3
sbt.version=1.10.7
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object Aligncheck extends Tool {
private def filterResultsForFiles(results: List[Result], filesOpt: Option[Set[Source.File]]): List[Result] = {
filesOpt.fold(results) { files =>
results.collect {
case res: Result.Issue if files.contains(res.file) => res
case res: Result.Issue if files.contains(res.filename) => res

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The upgrade to codacy-engine-scala-seed v6 changed the Result.Issue model field from file: Source.File to filename: String. Because the files variable is a Set[Source.File], the contains check will now always return false at runtime due to the type mismatch, effectively filtering out all issues when the tool is run on a specific file list.

Suggested change
case res: Result.Issue if files.contains(res.filename) => res
case res: Result.Issue if files.contains(Source.File(res.filename)) => res

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The filtering logic contains a type mismatch and a logic error. The files set contains Source.File objects, but res.filename is a String; this mismatch causes the filter to exclude all results when specific files are requested (e.g., in PR analysis). Additionally, using collect specifically for Result.Issue causes FileError and GenericError to be dropped.

Consider using filter to preserve all relevant types and converting the filename back to a Source.File for comparison:

Suggested change
case res: Result.Issue if files.contains(res.filename) => res
case res: Result.Issue if files.contains(Source.File(res.filename)) => res

}
}
}
Expand Down