Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rarst/phpcs-cognitive-complexity
Cognitive Complexity implementation for PHP_CodeSniffer
https://github.com/rarst/phpcs-cognitive-complexity
php phpcs phpcs-standard
Last synced: 2 months ago
JSON representation
Cognitive Complexity implementation for PHP_CodeSniffer
- Host: GitHub
- URL: https://github.com/rarst/phpcs-cognitive-complexity
- Owner: Rarst
- License: other
- Created: 2019-12-23T13:14:26.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-24T23:42:49.000Z (10 months ago)
- Last Synced: 2024-10-17T08:50:36.827Z (3 months ago)
- Topics: php, phpcs, phpcs-standard
- Language: PHP
- Size: 28.3 KB
- Stars: 26
- Watchers: 4
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PHPCS Cognitive Complexity
_Make it maintainable or else._
[![Tests Status](https://github.com/rarst/phpcs-cognitive-complexity/actions/workflows/tests.yml/badge.svg)](https://github.com/Rarst/phpcs-cognitive-complexity/actions/workflows/tests.yml)
[![Latest Stable Version](https://img.shields.io/packagist/v/rarst/phpcs-cognitive-complexity.svg?label=version)](https://packagist.org/packages/rarst/phpcs-cognitive-complexity)
[![PHP from Packagist](https://img.shields.io/packagist/php-v/rarst/phpcs-cognitive-complexity.svg)](https://packagist.org/packages/rarst/phpcs-cognitive-complexity)
[![PDS Skeleton](https://img.shields.io/badge/pds-skeleton-blue.svg)](https://github.com/php-pds/skeleton)The project implements [Cognitive Complexity metric by SonarSource](https://www.sonarsource.com/resources/white-papers/cognitive-complexity.html) as [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) standard.
## Install
### Composer
```bash
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
```bash
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](https://github.com/Symplify/Symplify).
## License
MIT