You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+59-8Lines changed: 59 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,18 +186,69 @@ VariableHardUsage is an index used to evaluate the frequency of use and scope of
186
186
187
187
### Calculation Procedure
188
188
189
-
1. Obtain the line numbers of the references to the same variable:.
189
+
This tool calculates the **Variable Hard Usage** score for each **scope** (i.e., a functionor method) based on how local variables are used. The calculation consists of the following steps:
190
190
191
-
* For each variable used in the function, retrieve all line numbers where the variable is referenced.
191
+
---
192
192
193
-
2. Calculate deviation based on first occurrence.
193
+
#### 1. Extract local variables in a scope
194
194
195
-
*For each reference, computes the difference between the line number and the line number of the first occurrence of the variable.
195
+
For each scope $S$, extract all local variables:
196
196
197
-
3. Applying coefficients by assignment.
198
-
* When a variable is assigned, the difference is multiplied by a coefficient (2 by default). This is to account for the effect of the assignment on the frequency of use of the variable.
199
-
* Calculation of VariableHardUsage:.
200
-
* The VariableHardUsage is obtained by summing all these deviation values.
197
+
$$
198
+
V = {v_1, v_2, ..., v_m}
199
+
$$
200
+
201
+
---
202
+
203
+
#### 2. For each variable $v_j$, identify lines where it is referenced
204
+
205
+
Let the variable $v_j$ be referenced at line numbers:
0 commit comments