diff --git a/src/main/java/org/openrewrite/docker/search/FindDockerImageUses.java b/src/main/java/org/openrewrite/docker/search/FindDockerImageUses.java index 3908365..0510fbc 100644 --- a/src/main/java/org/openrewrite/docker/search/FindDockerImageUses.java +++ b/src/main/java/org/openrewrite/docker/search/FindDockerImageUses.java @@ -59,7 +59,7 @@ public TreeVisitor 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); } diff --git a/src/main/java/org/openrewrite/docker/table/DockerBaseImages.java b/src/main/java/org/openrewrite/docker/table/DockerBaseImages.java index ae65b97..ac168d6 100644 --- a/src/main/java/org/openrewrite/docker/table/DockerBaseImages.java +++ b/src/main/java/org/openrewrite/docker/table/DockerBaseImages.java @@ -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; diff --git a/src/main/java/org/openrewrite/docker/trait/DockerfileImageReference.java b/src/main/java/org/openrewrite/docker/trait/DockerfileImageReference.java index 2e689bc..7fc025f 100644 --- a/src/main/java/org/openrewrite/docker/trait/DockerfileImageReference.java +++ b/src/main/java/org/openrewrite/docker/trait/DockerfileImageReference.java @@ -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; } diff --git a/src/main/java/org/openrewrite/docker/trait/ImageMatcher.java b/src/main/java/org/openrewrite/docker/trait/ImageMatcher.java index 1e71016..2c767da 100644 --- a/src/main/java/org/openrewrite/docker/trait/ImageMatcher.java +++ b/src/main/java/org/openrewrite/docker/trait/ImageMatcher.java @@ -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