Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Jan 10, 2025
1 parent 184d59b commit eb50744
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/fuzz_introspector/frontends/frontend_jvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"null_literal": "null"
}


class SourceCodeFile():
"""Class for holding file-specific information."""

Expand Down Expand Up @@ -570,8 +571,7 @@ def _process_invoke_args(

# Only store type value is not found
for node in other_type_node:
return_value, invoke = self._process_invoke(
node, classes)
return_value, invoke = self._process_invoke(node, classes)

if return_value and not found:
found = True
Expand Down Expand Up @@ -674,8 +674,8 @@ def _process_invoke(
elif cls_type.type == 'super':
object_type = self.class_interface.super_class

elif cls_type.type.endswith('type_identifier') or cls_type.type.endswith(
'_type'):
elif cls_type.type.endswith(
'type_identifier') or cls_type.type.endswith('_type'):
object_type = cls_type.text.decode().split('<')[0]

object_type = self.parent_source.get_full_qualified_name(
Expand Down Expand Up @@ -745,9 +745,8 @@ def _process_invoke(
return return_type, callsites

def _process_callsites(
self, stmt: Node,
classes: dict[str,
'JavaClassInterface']) -> tuple[str, list[tuple[str, int, int]]]:
self, stmt: Node, classes: dict[str, 'JavaClassInterface']
) -> tuple[str, list[tuple[str, int, int]]]:
"""Process and store the callsites of the method."""
type = ''
callsites = []
Expand Down Expand Up @@ -1172,6 +1171,9 @@ def extract_calltree(self,
if not method and source_code:
method = source_code.get_entry_method_name(True)

if not method:
return ''

line_to_print = ' ' * depth
line_to_print += method
line_to_print += ' '
Expand Down Expand Up @@ -1204,11 +1206,12 @@ def extract_calltree(self,

return line_to_print

def get_reachable_methods(self,
source_file: str,
source_code: Optional[SourceCodeFile] = None,
method: Optional[str] = None,
visited_methods: Optional[set[str]] = None) -> set[str]:
def get_reachable_methods(
self,
source_file: str,
source_code: Optional[SourceCodeFile] = None,
method: Optional[str] = None,
visited_methods: Optional[set[str]] = None) -> set[str]:
"""Get a list of reachable functions for a provided function name."""
if not visited_methods:
visited_methods = set()
Expand All @@ -1225,7 +1228,8 @@ def get_reachable_methods(self,
visited_methods.add(method)
return visited_methods
else:
visited_methods.add(method)
if method:
visited_methods.add(method)
return visited_methods

visited_methods.add(method)
Expand All @@ -1244,8 +1248,8 @@ def get_reachable_methods(self,
def capture_source_files_in_tree(directory_tree: str) -> list[str]:
"""Captures source code files in a given directory."""
exclude_directories = [
'target', 'node_modules', 'aflplusplus', 'honggfuzz',
'inspector', 'libfuzzer'
'target', 'node_modules', 'aflplusplus', 'honggfuzz', 'inspector',
'libfuzzer'
]
language_extensions = ['.java']
language_files = []
Expand Down

0 comments on commit eb50744

Please sign in to comment.