diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c66c66852..15eeb8560 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -62,5 +62,8 @@ jobs: - name: Install required dependencies run: sudo apt-get update && sudo apt-get install libxml2-utils - - name: Lint files + - name: Lint xml files run: make lint-xml + + - name: Lint xliff files + run: make lint-xliff diff --git a/Makefile b/Makefile index 411a24ff5..121b0b9ff 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ all: @echo "Please choose a task." .PHONY: all -lint: lint-composer lint-yaml lint-xml lint-php +lint: lint-composer lint-yaml lint-xml lint-xliff lint-php .PHONY: lint lint-composer: @@ -19,7 +19,7 @@ lint-yaml: .PHONY: lint-yaml lint-xml: - find . \( -name '*.xml' -or -name '*.xliff' \) \ + find . -name '*.xml' \ -not -path './vendor/*' \ -not -path './src/Resources/public/vendor/*' \ | while read xmlFile; \ @@ -30,6 +30,18 @@ lint-xml: .PHONY: lint-xml +lint-xliff: + find . -name '*.xliff' \ + -not -path './vendor/*' \ + -not -path './src/Resources/public/vendor/*' \ + | while read xmlFile; \ + do \ + XMLLINT_INDENT=' ' xmllint --encode UTF-8 --format "$$xmlFile"|diff - "$$xmlFile"; \ + if [ $$? -ne 0 ] ;then exit 1; fi; \ + done + +.PHONY: lint-xliff + lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run .PHONY: lint-php diff --git a/templates/project/.editorconfig b/templates/project/.editorconfig index 34b3f4735..ee0d74ca1 100644 --- a/templates/project/.editorconfig +++ b/templates/project/.editorconfig @@ -11,13 +11,13 @@ charset = utf-8 insert_final_newline = true trim_trailing_whitespace = true -[*.{yaml,yml,twig,php}] +[*.{xml,yaml,yml,twig,php}] indent_size = 4 [.yamllint] indent_size = 4 -[*.{js,json,scss,css}] +[*.{xliff,js,json,scss,css}] indent_size = 2 [composer.json] diff --git a/templates/project/.github/workflows/lint.yaml.twig b/templates/project/.github/workflows/lint.yaml.twig index bb03a42eb..63f18d7e6 100644 --- a/templates/project/.github/workflows/lint.yaml.twig +++ b/templates/project/.github/workflows/lint.yaml.twig @@ -73,5 +73,8 @@ jobs: - name: Install required dependencies run: sudo apt-get update && sudo apt-get install libxml2-utils - - name: Lint files + - name: Lint xml files run: make lint-xml + + - name: Lint xliff files + run: make lint-xliff diff --git a/templates/project/Makefile.twig b/templates/project/Makefile.twig index a4a1efdc8..60b480d75 100644 --- a/templates/project/Makefile.twig +++ b/templates/project/Makefile.twig @@ -6,7 +6,7 @@ all: @echo "Please choose a task." .PHONY: all -lint: lint-composer lint-yaml lint-xml lint-php +lint: lint-composer lint-yaml lint-xml lint-xliff lint-php .PHONY: lint lint-composer: @@ -19,7 +19,7 @@ lint-yaml: .PHONY: lint-yaml lint-xml: - find . \( -name '*.xml' -or -name '*.xliff' \) \ + find . -name '*.xml' \ -not -path './vendor/*' \ -not -path './src/Resources/public/vendor/*' \ | while read xmlFile; \ @@ -30,6 +30,18 @@ lint-xml: .PHONY: lint-xml +lint-xliff: + find . -name '*.xliff' \ + -not -path './vendor/*' \ + -not -path './src/Resources/public/vendor/*' \ + | while read xmlFile; \ + do \ + XMLLINT_INDENT=' ' xmllint --encode UTF-8 --format "$$xmlFile"|diff - "$$xmlFile"; \ + if [ $$? -ne 0 ] ;then exit 1; fi; \ + done + +.PHONY: lint-xliff + lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run .PHONY: lint-php