Skip to content

Commit

Permalink
Test all concats are okay
Browse files Browse the repository at this point in the history
  • Loading branch information
spaze committed Jul 21, 2024
1 parent 2d04968 commit 3479abd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
php-version: ${{ matrix.php-version }}
- run: make --directory=site check-application-mapping

check-sri-macros-concat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- run: make --directory=site check-sri-macros-concat

lint-php:
runs-on: ubuntu-latest
strategy:
Expand Down
7 changes: 5 additions & 2 deletions site/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: test composer-audit npm-audit cs-fix check-file-patterns check-makefile check-application-mapping lint-php lint-latte lint-neon lint-xml lint-xml-auto-install phpcs phpstan phpstan-latte-templates phpstan-vendor psalm tester tester-include-skipped gitleaks composer-dependency-analyser
.PHONY: test composer-audit npm-audit cs-fix check-file-patterns check-makefile check-application-mapping check-sri-macros-concat lint-php lint-latte lint-neon lint-xml lint-xml-auto-install phpcs phpstan phpstan-latte-templates phpstan-vendor psalm tester tester-include-skipped gitleaks composer-dependency-analyser

test: composer-audit npm-audit check-file-patterns check-makefile check-application-mapping lint-php lint-latte lint-neon lint-xml phpcs phpstan tester psalm phpstan-vendor composer-dependency-analyser
test: composer-audit npm-audit check-file-patterns check-makefile check-application-mapping check-sri-macros-concat lint-php lint-latte lint-neon lint-xml phpcs phpstan tester psalm phpstan-vendor composer-dependency-analyser

composer-audit:
composer audit
Expand All @@ -20,6 +20,9 @@ check-makefile:
check-application-mapping:
bin/check-application-mapping.php

check-sri-macros-concat:
bin/check-sri-macros-concat.sh

lint-php:
vendor/php-parallel-lint/php-parallel-lint/parallel-lint --colors -e php,phtml,phpt,phpstub app/ public/ stubs/ tests/

Expand Down
12 changes: 12 additions & 0 deletions site/bin/check-sri-macros-concat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

echo "Wrong spaze/sri-macros concatenations (without spaces, e.g. {script foo+bar}):"

BAD_LINES=$(grep --recursive --perl-regexp --ignore-case --line-number "{(script|stylesheet)" app/ | grep --perl-regexp "[^\s]\+|\+[^\s]")
if [ "$BAD_LINES" ]; then
echo "$BAD_LINES" | grep --color ".+."
exit 1
else
echo "None, all have spaces around the plus sign (foo + bar, not foo+bar)"
exit 0
fi

0 comments on commit 3479abd

Please sign in to comment.