Skip to content

Commit

Permalink
Use ' ' to indent xliff files (#1615)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Aug 9, 2021
1 parent 9894ab0 commit 2c3414f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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; \
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions templates/project/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 4 additions & 1 deletion templates/project/.github/workflows/lint.yaml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 14 additions & 2 deletions templates/project/Makefile.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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; \
Expand All @@ -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
Expand Down

0 comments on commit 2c3414f

Please sign in to comment.