Skip to content

Commit 89cd952

Browse files
committed
Added "META-INF" and "module-info.class" to ignore list #1876
- Everything under META-INF/ is generally metadata or configuration files that can be ignored. - module-info.class is typically a generated file - it's the compiled version of a Java module descriptor that can be ignored as well. Signed-off-by: Chin Yeung Li <[email protected]>
1 parent c5ec222 commit 89cd952

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

scanpipe/pipes/d2d_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class EcosystemConfig:
8585
ecosystem_option="Java",
8686
matchable_package_extensions=[".jar", ".war"],
8787
matchable_resource_extensions=[".class"],
88+
deployed_resource_path_exclusions=["*META-INF/*", "*/module-info.class"],
8889
),
8990
"Scala": EcosystemConfig(
9091
ecosystem_option="Scala",

scanpipe/tests/pipes/test_d2d.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,22 @@ def test_scanpipe_pipes_d2d_map_java_to_class_no_java(self):
448448
expected = "No ('.java',) resources to map."
449449
self.assertIn(expected, buffer.getvalue())
450450

451+
def test_scanpipe_pipes_d2d_java_ignore_pattern(self):
452+
make_resource_file(self.project1, path="to/module-info.class")
453+
make_resource_file(self.project1, path="to/META-INF/MANIFEST.MF")
454+
make_resource_file(self.project1, path="to/test.class")
455+
make_resource_file(self.project1, path="to/META-INF/others.txt")
456+
buffer = io.StringIO()
457+
458+
java_config = d2d_config.get_ecosystem_config(ecosystem="Java")
459+
d2d.ignore_unmapped_resources_from_config(
460+
project=self.project1,
461+
patterns_to_ignore=java_config.deployed_resource_path_exclusions,
462+
logger=buffer.write,
463+
)
464+
expected = "Ignoring 3 to/ resources with ecosystem specific configurations."
465+
self.assertIn(expected, buffer.getvalue())
466+
451467
def test_scanpipe_pipes_d2d_map_jar_to_java_source(self):
452468
from1 = make_resource_file(
453469
self.project1,

0 commit comments

Comments
 (0)