Skip to content

Commit 7fba427

Browse files
committed
Switch to allowlist for supported compile commands
Signed-off-by: John Pennycook <john.pennycook@intel.com>
1 parent 79ed385 commit 7fba427

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

codebasin/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,14 @@ def is_supported(self):
9090
True if the command can be emulated and False otherwise.
9191
Commands that are not supported will not impact analysis.
9292
"""
93-
# Empty commands don't do anything
94-
if len(self.arguments) == 0:
95-
return False
96-
97-
# Ignore commands operating on non-source files (e.g. linking)
98-
if not codebasin.source.is_source_file(self.filename):
99-
return False
100-
101-
return True
93+
# Commands must be non-empty in order to do something.
94+
# Commands must operate on source files.
95+
if len(self.arguments) > 0 and codebasin.source.is_source_file(
96+
self.filename,
97+
):
98+
return True
99+
100+
return False
102101

103102
@classmethod
104103
def from_json(cls, instance: dict):

0 commit comments

Comments
 (0)