Skip to content

Commit 58254c0

Browse files
committed
Remove unnecessary path check during the second pass on the codebase #1007
Signed-off-by: Jono Yang <[email protected]>
1 parent 764130e commit 58254c0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/scancode/plugin_ignore.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,24 @@ def process_codebase(self, codebase, ignore=(), **kwargs):
6464
}
6565

6666
ignorable = partial(is_ignored, ignores=ignores)
67-
rid_to_remove = []
67+
rids_to_remove = []
6868
remove_resource = codebase.remove_resource
6969

7070
# First, walk the codebase from the top-down and collect the rids of
7171
# Resources that can be removed.
7272
for resource in codebase.walk(topdown=True):
7373
if ignorable(resource.path):
7474
for child in resource.children(codebase):
75-
rid_to_remove.append(child.rid)
76-
rid_to_remove.append(resource.rid)
75+
rids_to_remove.append(child.rid)
76+
rids_to_remove.append(resource.rid)
7777

7878
# Then, walk bottom-up and remove the ignored Resources from the
7979
# Codebase if the Resource's rid is in our list of rid's to remove.
8080
for resource in codebase.walk(topdown=False):
81-
if ignorable(resource.path):
82-
if resource.rid in rid_to_remove:
83-
rid_to_remove.remove(resource.rid)
84-
remove_resource(resource)
81+
resource_rid = resource.rid
82+
if resource_rid in rids_to_remove:
83+
rids_to_remove.remove(resource_rid)
84+
remove_resource(resource)
8585

8686

8787
def is_ignored(location, ignores):

0 commit comments

Comments
 (0)