Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
timtebeek and github-actions[bot] authored Dec 30, 2024
1 parent d8532da commit 41f99c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public TreeVisitor<?, ExecutionContext> getVisitor() {
for (Reference ref : references) {
DockerImageVersion from = DockerImageVersion.of(ref.getValue());
dockerBaseImages.insertRow(ctx,
new DockerBaseImages.Row(sourcePath.toString(), tree.getClass().getSimpleName(), from.getImageName(), from.getVersion())
new DockerBaseImages.Row(sourcePath.toString(), from.getImageName(), from.getVersion())
);
matches.computeIfAbsent(ref.getTree(), t -> new ArrayList<>()).add(ref);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ public DockerBaseImages(Recipe recipe) {

@Value
public static class Row {
@Column(displayName = "Source path before the run",
description = "The source path of the file before the run.")
@Column(displayName = "Source path",
description = "The source file containing the image reference.")
String sourcePath;

@Column(displayName = "LST type",
description = "The LST model type that the file is parsed as.")
String type;

@Column(displayName = "Image name",
description = "The full name of the image.")
String imageName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public boolean isAcceptable(SourceFile sourceFile) {
if (sourceFile instanceof PlainText) {
PlainText text = (PlainText) sourceFile;
String fileName = text.getSourcePath().toFile().getName();
return (fileName.endsWith("Dockerfile") || fileName.equals("Containerfile"))
&& (text.getText().contains("FROM") || text.getText().contains("from"));
return (fileName.endsWith("Dockerfile") || fileName.equals("Containerfile")) &&
(text.getText().contains("FROM") || text.getText().contains("from"));
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ImageMatcher implements Reference.Matcher {

@Override
public boolean matchesReference(Reference reference) {
return reference.getKind().equals(Reference.Kind.IMAGE);
return reference.getKind() == Reference.Kind.IMAGE;
}

@Override
Expand Down

0 comments on commit 41f99c8

Please sign in to comment.