rarst/phpcs-cognitive-complexity

Cognitive complexity implementation for PHP_CodeSniffer

Installs: 43 639

Dependents: 1

Suggesters: 0

Security: 0

Stars: 26

Watchers: 4

Forks: 4

Open Issues: 6

Type:phpcodesniffer-standard

0.2 2019-12-24 14:23 UTC

This package is auto-updated.

Last update: 2024-11-22 23:13:06 UTC


README

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