Skip to content

Commit 9456c4e

Browse files
authored
chore: revamp lint and fix tasks naming (#120)
1 parent f065865 commit 9456c4e

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

.github/workflows/symfony.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: true
2020
matrix:
21-
php-versions: ['8.3']
21+
php-versions: ['8.2']
2222
runs-on: ubuntu-latest
2323

2424
steps:
@@ -91,7 +91,7 @@ jobs:
9191
# Setup ————————————————————————————————————————————————————————————————
9292
- uses: shivammathur/setup-php@v2
9393
with:
94-
php-version: '8.3'
94+
php-version: '8.2'
9595
tools: cs2pr, castor
9696
- uses: actions/checkout@v3
9797
- name: Get Composer Cache Directory

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ SHELL = sh
44
## —— 🎶 The MicroSymfony Makefile 🎶 ——————————————————————————————————————————
55
help: ## Outputs this help screen
66
@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/'
7-
.PHONY: help start stop go-prod go-dev purge test coverage cov-report stan fix-php lint-php lint-container lint-twig lint-yaml cs lint ci deploy
7+
.PHONY: help start stop go-prod go-dev purge test coverage cov-report stan fix-php lint-php lint-container lint-twig lint-yaml fix lint ci deploy
88
.PHONY: version-php version-composer version-symfony version-phpunit version-phpstan version-php-cs-fixer check-requirements
99

10-
# You can modify the coverage threshold here
10+
# You can modify the code coverage threshold here
1111
COVERAGE_THRESHOLD = 100
1212

1313
## —— Symfony binary 💻 ————————————————————————————————————————————————————————
@@ -51,14 +51,14 @@ cov-report: var/coverage/index.html ## Open the PHPUnit code coverage report (va
5151

5252

5353
## —— Coding standards/lints ✨ ————————————————————————————————————————————————
54-
stan: var/cache/dev/App_KernelDevDebugContainer.xml ## Run PHPStan
54+
stan: var/cache/dev/App_KernelDevDebugContainer.xml ## Run the PHPStan static analysis
5555
@vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G -vv
5656

5757
# PHPStan needs the dev/debug cache
5858
var/cache/dev/App_KernelDevDebugContainer.xml:
5959
APP_DEBUG=1 APP_ENV=dev bin/console cache:warmup
6060

61-
fix-php: ## Fix PHP files with php-cs-fixer (ignore PHP 8.2 warning)
61+
fix-php: ## Fix PHP files with php-cs-fixer (ignore PHP version warning)
6262
@PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix $(PHP_CS_FIXER_ARGS)
6363

6464
lint-php: ## Lint PHP files with php-cs-fixer (report only)
@@ -74,14 +74,14 @@ lint-twig: ## Lint Twig files
7474
lint-yaml: ## Lint YAML files
7575
@bin/console lint:yaml --parse-tags config/
7676

77-
cs: ## Run all CS checks
78-
cs: fix-php stan
77+
fix: ## Run all fixers
78+
fix: fix-php
7979

80-
lint: ## Run all lints
81-
lint: lint-php lint-container lint-twig lint-yaml
80+
lint: ## Run all linters
81+
lint: stan lint-php lint-container lint-twig lint-yaml
8282

8383
ci: ## Run CI locally
84-
ci: coverage warmup cs lint
84+
ci: coverage warmup lint
8585

8686

8787
## —— Other tools and helpers 🔨 ———————————————————————————————————————————————
@@ -103,15 +103,15 @@ version-phpstan:
103103
@vendor/bin/phpstan --version
104104
version-php-cs-fixer:
105105
@echo '\n—— php-cs-fixer ———————————————————————————————————————————————————'
106-
@vendor/bin/php-cs-fixer --version
106+
@PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer --version
107107
@echo
108108

109109
check-requirements: ## Checks requirements for running Symfony
110110
@vendor/bin/requirements-checker
111111

112112

113113
## —— Deploy & Prod 🚀 —————————————————————————————————————————————————————————
114-
deploy: ## Simple manual deploy on VPS (this is to update the demo site https://microsymfony.ovh/)
114+
deploy: ## Simple manual deploy on a VPS (this is to update the demo site https://microsymfony.ovh/)
115115
@git pull
116116
@composer install
117117
@chown -R www-data: var/*

castor.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,14 @@ function ci_lint_php(): int
179179
);
180180
}
181181

182-
#[AsTask(name: 'all', namespace: 'cs', description: 'Run all CS checks', aliases: ['cs'])]
182+
#[AsTask(name: 'all', namespace: 'fix', description: 'Run all CS checks', aliases: ['fix'])]
183183
function cs_all(): int
184184
{
185-
title('cs:all');
185+
title('fix:all');
186186
$ec1 = fix_php();
187-
$ec2 = stan();
188187
io()->newLine();
189188

190-
return success($ec1 + $ec2);
189+
return success($ec1);
191190
}
192191
#[AsTask(name: 'container', namespace: 'lint', description: 'Lint the Symfony DI container', aliases: ['lint-container'])]
193192
function lint_container(): int
@@ -217,12 +216,13 @@ function lint_yaml(): int
217216
function lint_all(): int
218217
{
219218
title('lint:all');
220-
$ec1 = lint_php();
221-
$ec2 = lint_container();
222-
$ec3 = lint_twig();
223-
$ec4 = lint_yaml();
219+
$ec1 = stan();
220+
$ec2 = lint_php();
221+
$ec3 = lint_container();
222+
$ec4 = lint_twig();
223+
$ec5 = lint_yaml();
224224

225-
return success($ec1 + $ec2 + $ec3 + $ec4);
225+
return success($ec1 + $ec2 + $ec3 + $ec4 + $ec5);
226226

227227
// if you want to speed up the process, you can run these commands in parallel
228228
// parallel(
@@ -240,8 +240,6 @@ function ci(): void
240240
purge();
241241
io()->section('Coverage');
242242
coverage();
243-
io()->section('Codings standards');
244-
cs_all();
245243
io()->section('Lints');
246244
lint_all();
247245
}
@@ -270,7 +268,10 @@ function versions(): void
270268
io()->newLine();
271269

272270
io()->note('php-cs-fixer');
273-
run('vendor/bin/php-cs-fixer --version');
271+
exit_code('vendor/bin/php-cs-fixer --version',
272+
context: context()->withEnvironment(['PHP_CS_FIXER_IGNORE_ENV' => 1])
273+
);
274+
274275
io()->newLine();
275276

276277
success(0);

0 commit comments

Comments
 (0)