webiik/cli-analyse

The simple CLI tool that helps you to analyze code quality.

Installs: 46

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Language:Shell

1.1 2021-07-02 12:45 UTC

This package is auto-updated.

Last update: 2024-04-29 04:03:14 UTC


README

68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77656269696b2f77656269696b2e737667 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d352d6f72616e67652e737667

Analyse

This CLI tool analyses code using preconfigured PHPCS, PHPMD, PHPSTAN, PHPmetrics and SonarCloud. It can help you to write better code and find possible errors.

It's very likely that this tool will find "bugs" in your code. Always investigate these "bugs" and consider a fix. Avoid over-optimization of code, always keep in mind readability and testability.

Installation

composer require --dev webiik/cli-analyse

Usage

analyse

analyse source-dir output-dir

analyse runs code analyses over the source directory and outputs analyses results to the output directory.

bash analyse /private/app/ /private/tmp/analysis/app/

Settings

In brief, command analyse tests code for the PSR-2 standards and PHP strict types. It uses the following settings:

phpmd [source_dir] html cleancode,codesize,design,naming,unusedcode --reportfile [output_dir]/phpmd/index.html
phpcs --standard=PSR2 --report-full=[output_dir]/phpcs/report-full.txt --report-code=[output_dir]/phpcs/report-code.txt [source_dir]
phpstan analyse [source_dir] -l 7 --no-ansi --no-progress | awk '{$1=$1;print}' > [output_dir]/phpstan/result.txt
phpmetrics --report-html=[output_dir]/phpmetrics [source_dir]
sonar-scanner \
-Dsonar.projectKey=[sonar project key] \
-Dsonar.organization=[sonar organization] \
-Dsonar.projectBaseDir=[source_dir] \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=[sonar login]

Resources