Skip to content

Commit

Permalink
refactored the NOMR calculation method
Browse files Browse the repository at this point in the history
  • Loading branch information
zaqbez39me committed May 18, 2024
1 parent c815fcf commit 83f743f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion metrics/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ def nomr(tlist: list[tuple[Any, javalang.tree.ClassDeclaration]]) -> float:
:rtype: float
"""
total_methods_number = total_methods(tlist)
return nom(tlist) / total_methods_number if total_methods_number != 0 else 0
if total_methods_number == 0:
return 0
nom_result = nom(tlist)
if nom_result == 0:
return 0
return nom_result / total_methods_number


def attrs(tlist: list[tuple[Any, javalang.tree.ClassDeclaration]]) -> int:
Expand Down

0 comments on commit 83f743f

Please sign in to comment.