Skip to content

Commit

Permalink
Ignore the "__MACOSX" macOS metadata folder dejacode#229 (#1558)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdruez authored Jan 22, 2025
1 parent ec2ca28 commit 0297b40
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions scanpipe/pipes/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"*/scancode-config.yml",
"policies.yml", # when located in the root dir
"*/policies.yml",
"*/__MACOSX*", # macOS metadata folder
]


Expand Down
15 changes: 15 additions & 0 deletions scanpipe/tests/pipes/test_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from scanpipe.models import CodebaseResource
from scanpipe.models import Project
from scanpipe.pipes import flag
from scanpipe.tests import make_project
from scanpipe.tests import make_resource_file


Expand Down Expand Up @@ -89,6 +90,20 @@ def test_scanpipe_pipes_flag_flag_ignored_patterns(self):
)
self.assertEqual(3, updated)

project2 = make_project()
make_resource_file(project2, "a.cdx.json.zip-extract")
r1 = make_resource_file(project2, "a.cdx.json.zip-extract/__MACOSX")
r2 = make_resource_file(
project2, "a.cdx.json.zip-extract/__MACOSX/._a.cdx.json"
)
make_resource_file(project2, "a.cdx.json.zip-extract/a.cdx.json")
updated = flag.flag_ignored_patterns(project2, flag.DEFAULT_IGNORED_PATTERNS)
self.assertEqual(2, updated)
ignored_qs = project2.codebaseresources.status(flag.IGNORED_PATTERN)
self.assertEqual(2, ignored_qs.count())
self.assertIn(r1, ignored_qs)
self.assertIn(r2, ignored_qs)

def test_scanpipe_pipes_flag_flag_not_analyzed_codebase_resources(self):
resource1 = CodebaseResource.objects.create(
project=self.project1, path="filename.ext"
Expand Down

0 comments on commit 0297b40

Please sign in to comment.