blumilksoftware / codestyle
Blumilk codestyle configurator
Installs: 17 707
Dependents: 8
Suggesters: 0
Security: 0
Stars: 12
Watchers: 6
Forks: 1
Open Issues: 15
Requires
- php: ^8.2
- friendsofphp/php-cs-fixer: ^3.59
- kubawerlos/php-cs-fixer-custom-fixers: ^3.21
Requires (Dev)
- jetbrains/phpstorm-attributes: ^1.1
- phpunit/phpunit: ^10.0|^11.2
- symfony/console: ^6.0|^7.0
- dev-main
- v4.0.0
- v3.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.0
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.10.0
- v1.9.0
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.10.0
- v0.9.0
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- 0.3.0
- 0.2.0
- 0.1.1
- 0.1.0
- 0.0.1
- dev-+132-change-order-in-ordered-class-elements
- dev-december-2024-batch-update
This package is auto-updated.
Last update: 2024-12-13 07:04:06 UTC
README
blumilksoftware/codebase
A common codestyle helper for all Blumilk projects.
Usage
Add package to our project:
composer require blumilksoftware/codestyle --dev
Then run following to create configuration file and add scripts to the composer.json
file:
./vendor/bin/codestyle init
Or you can create codestyle.php
file in your project's root directory:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; return new Config();
Configuration
You can configure paths and rules in Config
class constructor:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths; $paths = new LaravelPaths(); $config = new Config( paths: $paths->filter("app", "tests")->add("src"), ); return $config->config();
Or:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths; $config = new Config( paths: new LaravelPaths(LaravelPaths::LARAVEL_8_PATHS), ); return $config->config();
Or:
<?php declare(strict_types=1); use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Configuration\Defaults\Paths; $config = new Config( paths: new Paths("src"), ); return $config->config();
Usage with Composer
Add scripts to your composer.json
file:
{ "scripts": { "cs": "./vendor/bin/php-cs-fixer fix --dry-run --diff --config codestyle.php", "csf": "./vendor/bin/php-cs-fixer fix --diff --config codestyle.php" } }
Then run following command to check codestyle:
composer cs
or following to fix found errors:
composer csf
Additional configuration
If you want to disable risky rules, you can add withoutRiskyFixers
method to the config file:
return $config->withoutRiskyFixers()->config();
If you want to enable ignoring marked file, you can add ignoreMarkedFiles
method to the config file:
return $config->ignoreMarkedFiles()->config();
and then add // php-cs-fixer:ignore-file
to the file which you want to ignore.
Upgrading guide
Upgrading guide is available in upgrading.md file.
Contributing
In cloned or forked repository, run:
cp .env.example .env composer install
There are scripts available for package codestyle checking and testing:
There is also the Docker Compose configuration available:
docker compose up -d docker compose exec php php -v docker compose exec php composer -V
There are also Makefile commands available:
make run make shell make stop
Please maintain our project guidelines:
- keep issues well described, labeled and in English,
- add issue number to all your commits,
- add issue number to your branch name,
- squash your commits into one commit with standardized name.