Skip to content

Commit

Permalink
fix(tasks): added the missing lint-php task
Browse files Browse the repository at this point in the history
  • Loading branch information
COil committed Oct 12, 2023
1 parent 9f76f47 commit bef4d92
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL = sh
## —— 🎶 The MicroSymfony Makefile 🎶 ——————————————————————————————————————————
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help start stop test coverage cov-report stan fix-php lint-container lint-twig lint-yaml cs lint ci deploy
.PHONY: help start stop test coverage cov-report stan fix-php lint-php lint-container lint-twig lint-yaml cs lint ci deploy


## —— Symfony binary 💻 ————————————————————————————————————————————————————————
Expand Down Expand Up @@ -45,6 +45,9 @@ stan: ## Run PHPStan
fix-php: ## Fix PHP files with php-cs-fixer (ignore PHP 8.2 warning)
@PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --allow-risky=yes

lint-php: ## Lint PHP files with php-cs-fixer (report only)
@PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run

lint-container: ## Lint the Symfony DI container
@bin/console lint:container

Expand All @@ -58,7 +61,7 @@ cs: ## Run all CS checks
cs: fix-php stan

lint: ## Run all lints
lint: lint-container lint-twig lint-yaml
lint: lint-php lint-container lint-twig lint-yaml

ci: ## Run CI locally
ci: test cs lint
Expand Down
17 changes: 16 additions & 1 deletion castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ function fix_php(): void
success();
}

#[AsTask(namespace: 'cs', description: 'Lint PHP files with php-cs-fixer (report only)')]
function lint_php(): void
{
title(__FUNCTION__, get_command());
run('vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run',
environment: [
'PHP_CS_FIXER_IGNORE_ENV' => 1,
],
quiet: false
);
success();
}

#[AsTask(name: 'all', namespace: 'cs', description: 'Run all CS checks')]
function cs_all(): void
{
Expand Down Expand Up @@ -165,13 +178,15 @@ function lint_yaml(): void
function lint_all(): void
{
title(__FUNCTION__, get_command());
lint_php();
lint_container();
lint_twig();
lint_yaml();

// if you want to speed up the process, you can run these commands in parallel
// parallel(
// fn() => lint_container(null),
// fn() => lint_php(),
// fn() => lint_container(),
// fn() => lint_twig(),
// fn() => lint_yaml(),
// );
Expand Down

0 comments on commit bef4d92

Please sign in to comment.