Recommend this page to a friend! |
<p align="center"> <img src="https://github.com/DeGraciaMathieu/php-smelly-code-detector/blob/master/arts/robot.png" width="250"> </p>
> "A code smell is a surface indication that usually corresponds to a deeper problem in the system." > ~ Martin Fowler
Code smell is a potentially problematic code indicator with the following formula : ($ccn + $arg) * $loc
A high smell value will often reveal that the method is too complex.
This complexity could be detrimental to the maintainability of the method, favoring the appearance of bugs in the future.
This indicator does not replace the expertise of a developer and must above all be considered as an alarm detecting "smelly" code.
Requires >= PHP 8.1
composer require degraciamathieu/php-smelly-code-detector --dev
vendor/bin/smellyphpcodedetector inspect {folder}
| options | description | |-----------------------|-------------| | --min-smell= | Ignore methods with less than --min-smell | | --max-smell= | Ignore methods with more than --max-smell | | --limit= | Number of methods displayed. | | --without-constructor | Ignore method constructors from detection. | | --sort-by-smell | Sort the results by the smell of methods. |
$ php smellyphpcodedetector inspect app --sort-by-smell --limit=10
? PHP Smelly Code Detector ?
81 [============================] < 1 sec
+-----------------------------------------------------------+---------------------------------+-------+
| Files | Methods | smell |
+-----------------------------------------------------------+---------------------------------+-------+
| app/Http/Controllers/Blog/AdminPostController.php | update | 174 |
| app/Http/Controllers/Auth/NewPasswordController.php | store | 87 |
| app/Console/Commands/FetchGoogleFonts.php | store | 78 |
| app/Http/Middleware/RedirectIfAuthenticated.php | handle | 77 |
| app/Http/Controllers/User/ProfileController.php | updateAvatar | 75 |
| app/Services/Community/CreatorRepository.php | instantiateCreatorsFromResponse | 72 |
| app/Http/Controllers/Auth/PasswordResetLinkController.php | store | 51 |
| app/Http/Controllers/User/ProfileController.php | updateInformations | 51 |
| app/Http/Controllers/Auth/RegisteredUserController.php | store | 50 |
| app/Http/Controllers/Blog/ShowPostController.php | __invoke | 48 |
+-----------------------------------------------------------+---------------------------------+-------+
193 methods found.
Classes of DeGraciaMathieu | > | How to Use a PHP Quality Assurance Tool to Improve Your PHP Code Using the PHP Smelly Code Detector | > | ![]() |
> | ![]() |
> | ![]() |
> | ![]() ![]() |
|
|
Groups | Applications | ![]() |
Groups |
![]() |
Classes using PHP 5 specific features | View top rated classes |
![]() |
General purpose tools to simplify software development | View top rated classes |
![]() |
Programming language interpreters and format parsers | View top rated classes |
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation | ||
![]() ![]() |
Example | Example script |
![]() NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation | ||
![]() ![]() |
Example | Example script |
![]() |
/ | .github | / | workflows |
File | Role | Description |
---|---|---|
![]() ![]() |
Data | Auxiliary data |
![]() ![]() |
Data | Auxiliary data |
![]() |
/ | src |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
Class | Class source | ||
![]() |
Class | Class source |
![]() |
/ | src | / | Visitors |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
Class | Class source | ||
![]() |
Class | Class source | ||
![]() |
Class | Class source |
![]() |
/ | tests | / | Unit |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
Class | Class source | ||
![]() |
Class | Class source |
![]() NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|