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
+72-1Lines changed: 72 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,17 @@
3
3
## Overview
4
4
This PHP CLI tool analyzes the usage of local variables in PHP source code, focusing on their scope and update frequency. It helps developers identify potential issues in handling local variables, improving code quality and maintainability.
5
5
6
+
## What is "Local Variable Hard Usage"?
7
+
"Local Variable Hard Usage" is a concept that evaluates how intensely local variables are used in a function or method. This metric helps identify variables that might negatively impact code readability and maintainability due to excessive scope width and frequent updates.
8
+
9
+
The idea behind this metric is that when a local variable is referenced over a wide range of lines or is frequently modified, it becomes harder to understand and refactor. By quantifying this, we can gain insights into potential problem areas in the code.
10
+
11
+
This concept is introduced and explained in detail in the following blog post:
12
+
[Understanding Local Variable Hard Usage](https://blog.starbug1.com/archives/3022)
13
+
14
+
This tool analyzes PHP code using PHP-Parser to measure the "Local Variable Hard Usage" for each function and method. It calculates the average reference line span of each variable and sums the deviations from this average, providing a score that represents how heavily a variable is used within its scope.
15
+
16
+
6
17
## Features
7
18
- Analyzes local variable scope and update frequency.
8
19
- Provides insights into variable usage patterns.
@@ -11,4 +22,64 @@ This PHP CLI tool analyzes the usage of local variables in PHP source code, focu
If you specify the path of the file forwhich you want to measure the local variable abuse and run the program, a report will be displayedin JSON format.
0 commit comments