rarst / phpcs-cognitive-complexity
Cognitive complexity implementation for PHP_CodeSniffer
Installs: 42 472
Dependents: 1
Suggesters: 0
Security: 0
Stars: 26
Watchers: 4
Forks: 4
Open Issues: 6
Type:phpcodesniffer-standard
Requires
- php: >=7.2
Requires (Dev)
- pds/skeleton: ^1.0
- squizlabs/php_codesniffer: ^3.5
Suggests
- dealerdirect/phpcodesniffer-composer-installer: Installer plugin for automatic standard registration.
This package is auto-updated.
Last update: 2024-10-22 22:56:21 UTC
README
Make it maintainable or else.
The project implements Cognitive Complexity metric by SonarSource as PHP_CodeSniffer standard.
Install
Composer
composer init --no-interaction composer require rarst/phpcs-cognitive-complexity squizlabs/php_codesniffer dealerdirect/phpcodesniffer-composer-installer vendor/bin/phpcs --standard=CognitiveComplexity /path/to/scan
Standalone
git clone https://github.com/Rarst/phpcs-cognitive-complexity phpcs --standard=phpcs-cognitive-complexity/src/CognitiveComplexity /path/to/scan
Limitations
- detection of boolean operator chains is not perfect, due to complexity of many possible cases.
Credits
Initial code forked from Symplify Coding Standard.
License
MIT