Skip to content

Commit

Permalink
Switch to allowlist for supported compile commands
Browse files Browse the repository at this point in the history
Signed-off-by: John Pennycook <john.pennycook@intel.com>
  • Loading branch information
Pennycook committed Mar 18, 2024
1 parent 79ed385 commit 7fba427
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions codebasin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,14 @@ def is_supported(self):
True if the command can be emulated and False otherwise.
Commands that are not supported will not impact analysis.
"""
# Empty commands don't do anything
if len(self.arguments) == 0:
return False

# Ignore commands operating on non-source files (e.g. linking)
if not codebasin.source.is_source_file(self.filename):
return False

return True
# Commands must be non-empty in order to do something.
# Commands must operate on source files.
if len(self.arguments) > 0 and codebasin.source.is_source_file(
self.filename,
):
return True

return False

@classmethod
def from_json(cls, instance: dict):
Expand Down

0 comments on commit 7fba427

Please sign in to comment.