https://github.com/degraciamathieu/php-line-length-detector
A simple way to analyze the line length of your PHP files.
https://github.com/degraciamathieu/php-line-length-detector
ci metrics php quality static-analyzer
Last synced: 11 months ago
JSON representation
A simple way to analyze the line length of your PHP files.
- Host: GitHub
- URL: https://github.com/degraciamathieu/php-line-length-detector
- Owner: DeGraciaMathieu
- Created: 2022-12-05T18:52:12.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-15T16:11:11.000Z (almost 3 years ago)
- Last Synced: 2024-12-13T13:41:34.407Z (over 1 year ago)
- Topics: ci, metrics, php, quality, static-analyzer
- Language: PHP
- Homepage:
- Size: 8.63 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/DeGraciaMathieu/php-line-length-detector/actions/workflows/testing.yml)


# php-line-length-detector
A simple way to analyze the line length of your PHP files.
# Installation
```
Requires >= PHP 8.1
```
## Phar
This tool is distributed as a [PHP Archive (PHAR)](https://www.php.net/phar):
```
wget https://github.com/DeGraciaMathieu/php-line-length-detector/raw/master/builds/php-line-length-detector
```
```
php php-line-length-detector --version
```
## Composer
Alternately, you can directly use composer :
```
composer require degraciamathieu/php-line-length-detector --dev
```
# Usage
```
php php-line-length-detector inspect {path}
```
```
$ php php-line-length-detector inspect app
❀ PHP Line Lenght Detector ❀
+-------------+--------------+--------------+
| total lines | largest line | average line |
+-------------+--------------+--------------+
| 1068 | 197 | 37 |
+-------------+--------------+--------------+
+--------+------------+---------+
| length | occurrence | percent |
+--------+------------+---------+
| > 160 | 2 | 0 % |
| > 120 | 5 | 0 % |
| > 80 | 29 | 2 % |
| > 60 | 111 | 10 % |
| > 30 | 618 | 57 % |
+--------+------------+---------+
```
You can configure thresholds with the `--thresholds=` option (default : 160,120,80,60,30) :
```
$ php php-line-length-detector inspect app --thresholds=120,60
❀ PHP Line Lenght Detector ❀
+-------------+--------------+--------------+
| total lines | largest line | average line |
+-------------+--------------+--------------+
| 1068 | 197 | 37 |
+-------------+--------------+--------------+
+--------+------------+---------+
| length | occurrence | percent |
+--------+------------+---------+
| > 120 | 5 | 0 % |
| > 60 | 111 | 10 % |
+--------+------------+---------+
```