stickee / canary
Canary provides linting and static analysis for Stickee Laravel projects
Installs: 10 685
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:project
Requires
- php: ^8.3
- composer-runtime-api: ^2.2.2
- laravel-zero/framework: ^11.0
- nunomaduro/termwind: ^2.0
- stickee/larastan-config: ^2.1.1
- stickee/php-cs-fixer-config: ^2.4.0
- stickee/rector-config: ^3.0
- symfony/process: ^7.0
Requires (Dev)
- intonate/tinker-zero: ^1.2
- mockery/mockery: ^1.4.4
- pestphp/pest: ^2.0
- roave/security-advisories: dev-latest
README
Introduction
Canary provides linting and static analysis for stickee Laravel projects.
It includes:
- the stickee PHP CS Fixer config to adhere to our code styles
- the stickee Larastan config to analyse your code
- the stickee Rector config to refactor your code
- shortcuts to run the included tools
- an installation command
Husky and Lint Staged
Lint Staged can be used to lint staged files and Husky can be used to manage the pre-commit hook that would call it.
The install
command will copy example configs over for these tools but you must install them before running it.
Installation
mkdir -p tools/canary composer require --working-dir=tools/canary stickee/canary tools/canary/vendor/bin/canary install
Why do we install tools into their own directory?
You should commit this new directory and the config files that are installed.
Usage
Canary provides a unified and decoupled platform for making use of powerful linting and static analysis tools that we make heavy use of at stickee.
Options
To pass options through you must write them after a --
.
tools/canary/vendor/bin/canary analyse -- -c phpstan.ci.neon --error-format=github
Commands
analyse
tools/canary/vendor/bin/canary analyse -- -c phpstan.dist.neon
This command will perform static-analysis of your whole project.
It should be ran as part of the pre-commit
hook.
See stickee/larastan-config for more details.
fix
tools/canary/vendor/bin/canary fix -- --config .php-cs-fixer.dist.php
This command will attempt to fix minor code style issues.
It can be ran against a single file.
It should be ran against staged files as part of the pre-commit
hook.
See stickee/php-cs-fixer-config for more details.
suggest
Rector in --dry-run
mode
tools/canary/vendor/bin/canary suggest
This command will suggest improvements as diffs in the terminal.
Any suggest
ed improvements must be performed manually or you can run the improve
command to do it for you.
See stickee/rector-config for more details.
improve
tools/canary/vendor/bin/canary improve
This command will refactor your code in an attempt to improve it.
Any improve
d code must be checked before committing.
It can be ran against a single file.
It should not be ran as part of the pre-commit
hook.
See stickee/rector-config for more details.
Note
You may find it useful to add these improve
ments as patches with Git.
You could use a Git integration in your editor or stage the improve
ments as patches with:
git add <file> -p
Contributions
Contributions are welcome! Canary is written using Laravel Zero. Improvements to any of the amalgamated open source tools should be directed towards their respective repositories.
You are encouraged to provide tests, which are written using the Pest testing framework.
License
Canary is open source software licensed under the MIT license.