rarst/phpcs-cognitive-complexity

Cognitive complexity implementation for PHP_CodeSniffer

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 2

Forks: 0

Open Issues: 1

Type:phpcodesniffer-standard

0.2 2019-12-24 14:23 UTC

This package is auto-updated.

Last update: 2020-11-24 16:31:06 UTC


README

Make it maintainable or else.

Scrutinizer Code Quality Build Status Code Coverage 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