Skip to content

Cognitive Complexity implementation for PHP_CodeSniffer

License

Notifications You must be signed in to change notification settings

Rarst/phpcs-cognitive-complexity

Repository files navigation

PHPCS Cognitive Complexity

Make it maintainable or else.

Tests Status Latest Stable Version PHP from Packagist PDS Skeleton

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

About

Cognitive Complexity implementation for PHP_CodeSniffer

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages