Skip to content

Commit

Permalink
reset to master
Browse files Browse the repository at this point in the history
  • Loading branch information
jovi1994 committed Nov 28, 2024
1 parent 768e02e commit 85d161a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
14 changes: 5 additions & 9 deletions metrics/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,8 @@ class NotClassError(Exception):
f'Number of Non-Static (Object) Methods\n')
metric.write(f'NoCM {smethods(tree_class)} '
f'Number of Static (Class) Methods\n')
metric.write(f'NCSS {ncss(raw)} '
f"""Non-Commenting Source Statements (NCSS). This metric that measures the number of lines
in source code that are not comments or blank lines. It focuses on the actual executable
statements in the code, excluding any documentation or formatting lines. \n""")
metric.write(f'NCSS {ncss(raw)}
f'Non-Commenting Source Statements (NCSS)\n')
metric.write(f'NoII {impls(tree_class)} '
f'Number of Implemented Interfaces\n')
metric.write(f'NAPC {extnds(tree_class)} '
Expand Down Expand Up @@ -524,12 +522,10 @@ class NotClassError(Exception):
f'Number of Polymorphic Methods (NOP), which is the count of methods \
that are overloaded at least once --- have similar names but different parameters\n')
metric.write(f'NULLs {nulls(tree_class)} '
f'Number of references that are NULL by default in a given class \n')
f'Number of NULL References\n')
metric.write(f'DOER {doer(tree_class)} '
f"""Data vs Object Encapsulation Ratio (DOER). This metric represents the ratio of
attributes that store primitive data types (e.g., int, char, boolean) to the total number
of attributes in a class. It provides insight into the balance between simple data storage
(primitives) and references to more complex objects (references).\n""")
f'Data vs Object Encapsulation Ratio\n')

except FileNotFoundError as exception:
message = f"{type(exception).__name__} {str(exception)}: {java}"
sys.exit(message)
10 changes: 5 additions & 5 deletions metrics/multimetric.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ temp="${TARGET}/temp/multimetric.json"
mkdir -p "$(dirname "${temp}")"
echo "${body}" > "${temp}"
cat <<EOT> "${output}"
HSD $(echo "${body}" | jq '.halstead_difficulty' | "${LOCAL}/help/float.sh") \textbf{Halstead Difficulty}: This metric measures the difficulty of understanding a program based on the number of distinct operators and operands used. A higher Halstead Difficulty indicates that the program is harder to understand and maintain due to its complexity. It is calculated using the formula: \( \text{Difficulty} = \frac{(n_1)}{2} \times \frac{(n_2)}{n_2} \), where \( n_1 \) is the number of distinct operators, and \( n_2 \) is the number of distinct operands. See details: \href{https://en.wikipedia.org/wiki/Halstead_complexity_measures#Difficulty}{Halstead Difficulty on Wikipedia}
HSE $(echo "${body}" | jq '.halstead_effort' | "${LOCAL}/help/float.sh") \textbf{Halstead Effort}: This metric estimates the total effort required to understand and implement a program based on its size and complexity. The higher the effort, the more difficult the program is to maintain and modify. Halstead Effort is calculated as \( \text{Effort} = \text{Difficulty} \times \text{Volume} \), where Difficulty is the Halstead Difficulty, and Volume represents the size of the program. A higher value reflects more effort required for comprehension and modification. See details: \href{https://en.wikipedia.org/wiki/Halstead_complexity_measures#Effort}{Halstead Effort on Wikipedia}
HSV $(echo "${body}" | jq '.halstead_volume' | "${LOCAL}/help/float.sh") \textbf{Halstead Volume}: This metric measures the size of a program based on its operators and operands. Halstead Volume estimates the amount of mental effort required to understand the code. It is calculated as \( \text{Volume} = (n_1 + n_2) \times \log_2 (n_1 + n_2) \), where \( n_1 \) and \( n_2 \) are the number of distinct operators and operands, respectively. A larger volume indicates a larger and potentially more complex program. See details: \href{https://en.wikipedia.org/wiki/Halstead_complexity_measures#Volume}{Halstead Volume on Wikipedia}
MIdx $(echo "${body}" | jq '.maintainability_index' | "${LOCAL}/help/float.sh") \textbf{Maintainability Index}: This metric is used to assess the maintainability of a software system based on its complexity and readability. It is a composite measure that takes into account various code metrics such as lines of code, cyclomatic complexity, and Halstead volume. The higher the Maintainability Index, the more maintainable the code is considered to be. The index is typically calculated using the formula:
FOut $(echo "${body}" | jq '.fanout_external' | "${LOCAL}/help/float.sh") \textbf{Fan-Out}: This metric measures the extent to which a class or module depends on external components or other classes. A higher Fan-Out indicates that the class has a greater number of dependencies, which can lead to increased complexity and potential difficulties in maintaining the system. See details: \href{https://en.wikipedia.org/wiki/Fan-out_(software)}{Fan-Out on Wikipedia}
HSD $(echo "${body}" | jq '.halstead_difficulty' | "${LOCAL}/help/float.sh") Halstead Difficulty~\citep{halstead1977elements}
HSE $(echo "${body}" | jq '.halstead_effort' | "${LOCAL}/help/float.sh") Halstead Effort~\citep{halstead1977elements}
HSV $(echo "${body}" | jq '.halstead_volume' | "${LOCAL}/help/float.sh") Halstead Volume~\citep{halstead1977elements}
MIdx $(echo "${body}" | jq '.maintainability_index' | "${LOCAL}/help/float.sh") Maintainability Index~\citep{coleman1994}
FOut $(echo "${body}" | jq '.fanout_external' | "${LOCAL}/help/float.sh") \href{https://en.wikipedia.org/wiki/Fan-out_(software)}{Fan-Out}
EOT

0 comments on commit 85d161a

Please sign in to comment.