diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6d737e8ed..dcb9edf66 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -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: diff --git a/site/Makefile b/site/Makefile index 859702055..500c7ff20 100644 --- a/site/Makefile +++ b/site/Makefile @@ -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 @@ -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/ diff --git a/site/bin/check-sri-macros-concat.sh b/site/bin/check-sri-macros-concat.sh new file mode 100755 index 000000000..ca8d7a754 --- /dev/null +++ b/site/bin/check-sri-macros-concat.sh @@ -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