mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 07:11:18 +02:00
justfile: standardise test recipes to lint-php/lint-css/lint-js/test + add fix recipe
- Removed ambiguous aliases: phpstan, cs-check (both pointed to lint-php which also ran php-cs-fixer, making the names misleading) - Removed syntax (php -l) — redundant, phpstan already catches parse errors - Split lint-biome into lint-css and lint-js with correct paths - Added lint meta-recipe that runs all three linters - Added fix recipe: biome check --write (CSS/JS format+lint) + php-cs-fixer fix (PHP) - Updated build-lint to delegate to lint-css + lint-js
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
@@ -18,3 +18,4 @@
|
||||
- [x] Add bulk select/delete to tmp cleanup dialog (like admin/index.php pattern)
|
||||
- [x] Move cleanup UI from modal to dedicated page (like add.php/edit.php)
|
||||
- [x] Replace <details> with <fieldset>/<legend> in cleanup fragments (like contenus.php)
|
||||
- [x] Standardise test group recipes: lint-php, lint-css, lint-js, test + add fix recipe
|
||||
|
||||
@@ -125,8 +125,13 @@ class SearchController
|
||||
// HTMX partial: render just the results fragment and exit
|
||||
if ($isHtmx) {
|
||||
$this->renderSearchResultsFragment(compact(
|
||||
'results', 'totalItems', 'totalPages', 'page',
|
||||
'baseParams', 'coverMap', 'validationError',
|
||||
'results',
|
||||
'totalItems',
|
||||
'totalPages',
|
||||
'page',
|
||||
'baseParams',
|
||||
'coverMap',
|
||||
'validationError',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,15 @@ class FormBootstrap
|
||||
public static function adminOld(array &$formData): callable
|
||||
{
|
||||
return function (string $key, string $default = '') use (&$formData): string|array {
|
||||
if (!isset($formData[$key])) return $default;
|
||||
if (is_array($formData[$key])) return $formData[$key];
|
||||
if ($formData[$key] === null) return $default;
|
||||
if (!isset($formData[$key])) {
|
||||
return $default;
|
||||
}
|
||||
if (is_array($formData[$key])) {
|
||||
return $formData[$key];
|
||||
}
|
||||
if ($formData[$key] === null) {
|
||||
return $default;
|
||||
}
|
||||
return htmlspecialchars((string)$formData[$key]);
|
||||
};
|
||||
}
|
||||
@@ -159,7 +165,9 @@ class FormBootstrap
|
||||
'helpBlocks' => $helpBlocks,
|
||||
'oldFn' => self::adminOld($formData),
|
||||
'withAutofocusFn' => function (string $field, array $attrs = []) use ($autofocusField): array {
|
||||
if ($autofocusField === $field) $attrs['autofocus'] = true;
|
||||
if ($autofocusField === $field) {
|
||||
$attrs['autofocus'] = true;
|
||||
}
|
||||
return $attrs;
|
||||
},
|
||||
|
||||
|
||||
+2
-1
@@ -10,7 +10,8 @@
|
||||
* Usage: <?= icon('trash') ?>
|
||||
* <?= icon('search', 0, 'header-search-icon') ?>
|
||||
*/
|
||||
function icon(string $name, int $size = 0, string $class = ''): string {
|
||||
function icon(string $name, int $size = 0, string $class = ''): string
|
||||
{
|
||||
$path = APP_ROOT . "/public/assets/icons/{$name}.svg";
|
||||
if (!file_exists($path)) {
|
||||
return "<!-- icon not found: {$name} -->";
|
||||
|
||||
@@ -76,7 +76,8 @@ build-install:
|
||||
|
||||
[group('build')]
|
||||
build-lint:
|
||||
@npx biome lint app/public/assets/css/ app/public/assets/js/app/ scripts/
|
||||
@just lint-css
|
||||
@just lint-js
|
||||
|
||||
[group('build')]
|
||||
build-check:
|
||||
@@ -443,31 +444,35 @@ test-coverage:
|
||||
# Generate HTML coverage report in coverage/
|
||||
@vendor/bin/phpunit --coverage-html coverage/ tests/phpunit/
|
||||
|
||||
[group('test')]
|
||||
lint-biome:
|
||||
@biome lint app/public/assets/js/
|
||||
|
||||
[group('test')]
|
||||
lint-php:
|
||||
# Static analysis + coding standards check
|
||||
# Static analysis (phpstan) + coding standards (php-cs-fixer)
|
||||
@vendor/bin/phpstan analyse --memory-limit=512M
|
||||
@vendor/bin/php-cs-fixer check --no-interaction
|
||||
|
||||
[group('test')]
|
||||
cs-fix:
|
||||
lint-css:
|
||||
# Lint CSS with biome
|
||||
@npx biome lint app/public/assets/css/
|
||||
|
||||
[group('test')]
|
||||
lint-js:
|
||||
# Lint JS/build scripts with biome
|
||||
@npx biome lint app/public/assets/js/app/ scripts/
|
||||
|
||||
[group('test')]
|
||||
lint:
|
||||
# Run all linters
|
||||
@just lint-php
|
||||
@just lint-css
|
||||
@just lint-js
|
||||
|
||||
[group('test')]
|
||||
fix:
|
||||
# Auto-fix: biome (JS/CSS formatting + lint) + php-cs-fixer (PHP coding standards)
|
||||
@npx biome check --write app/public/assets/css/ app/public/assets/js/app/ scripts/
|
||||
@vendor/bin/php-cs-fixer fix --no-interaction
|
||||
|
||||
[group('test')]
|
||||
phpstan: lint-php
|
||||
|
||||
[group('test')]
|
||||
cs-check: lint-php
|
||||
|
||||
[group('test')]
|
||||
syntax:
|
||||
@find app/ -name '*.php' -exec php -l {} \; 2>/dev/null | grep -v 'No syntax errors' || true
|
||||
@echo '✅ Syntax OK'
|
||||
|
||||
# ============================================================================
|
||||
# Database
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user