Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <[email protected]>
  • Loading branch information
arthurscchan committed Jan 16, 2025
1 parent 80ca883 commit 4825a93
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 40 deletions.
8 changes: 4 additions & 4 deletions src/fuzz_introspector/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ def extract_function_details(args) -> int:

if source_file == target_file:
if func['start_line'] <= target_line <= func['end_line']:
logger.info('Target function found in line %d of file %s.' % (target_line, target_file))
logger.info('Target function found in line %d of file %s.' %
(target_line, target_file))

with open(output, 'w') as f:
json.dump(func, f, indent=4)

return 0

logger.info(
'Failed to extract functions from source file %s line: %d' %
(args.target_file, target_line))
logger.info('Failed to extract functions from source file %s line: %d' %
(args.target_file, target_line))

return -1
83 changes: 47 additions & 36 deletions src/fuzz_introspector/frontends/frontend_jvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,25 +302,44 @@ def __init__(self,
def to_dict(self) -> dict[str, Any]:
"""Converts the JavaMethod instance into a dictionary representation."""
return {
'func_name': self.name,
'start_line': self.start_line,
'end_line': self.end_line,
'is_constructor': self.is_constructor,
'public': self.public,
'static': self.static,
'complexity': self.complexity,
'icount': self.icount,
'arg_names': self.arg_names,
'arg_types': self.arg_types,
'return_type': self.return_type,
'exceptions': self.exceptions,
'function_depth': self.function_depth,
'function_uses': self.function_uses,
'base_callsites': self.base_callsites,
'detailed_callsites': self.detailed_callsites,
'is_entry_method': self.is_entry_method,
'class_interface': self.class_interface.to_dict(),
'source_code': self.parent_source.to_dict()
'func_name':
self.name,
'start_line':
self.start_line,
'end_line':
self.end_line,
'is_constructor':
self.is_constructor,
'public':
self.public,
'static':
self.static,
'complexity':
self.complexity,
'icount':
self.icount,
'arg_names':
self.arg_names,
'arg_types':
self.arg_types,
'return_type':
self.return_type,
'exceptions':
self.exceptions,
'function_depth':
self.function_depth,
'function_uses':
self.function_uses,
'base_callsites':
self.base_callsites,
'detailed_callsites':
self.detailed_callsites,
'is_entry_method':
self.is_entry_method,
'class_interface':
self.class_interface.to_dict(),
'source_code':
self.parent_source.to_dict() if self.parent_source else None
}

def post_process_full_qualified_name(self):
Expand Down Expand Up @@ -883,22 +902,14 @@ def __init__(self,
def to_dict(self) -> dict[str, Any]:
"""Converts the JavaClassInterface instance into a dictionary representation."""
return {
'class_name':
self.name,
'class_package':
self.package,
'class_public':
self.class_public,
'class_concrete':
self.class_concrete,
'is_interface':
self.is_interface,
'class_fields':
self.class_fields,
'super_class':
self.super_class,
'super_interfaces':
self.super_interfaces
'class_name': self.name,
'class_package': self.package,
'class_public': self.class_public,
'class_concrete': self.class_concrete,
'is_interface': self.is_interface,
'class_fields': self.class_fields,
'super_class': self.super_class,
'super_interfaces': self.super_interfaces
}

def add_package_to_class_name(self, name: str) -> Optional[str]:
Expand Down Expand Up @@ -1086,7 +1097,7 @@ def _get_all_functions(self, cls: JavaClassInterface) -> list[JavaMethod]:
result_list = []
result_list.extend(cls.methods)
for inner_class in cls.inner_classes:
rersult_list.extend(self._get_all_functions(inner_class))
result_list.extend(self._get_all_functions(inner_class))

return result_list

Expand Down

0 comments on commit 4825a93

Please sign in to comment.