Skip to content

Commit

Permalink
Normalize xml ruleset file
Browse files Browse the repository at this point in the history
  • Loading branch information
brianvarskonst committed Jun 3, 2024
1 parent b864ac9 commit 9ae0f6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd Brianvarskonst/ruleset.xml
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.Brianvarskonst.xml
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist
- run: diff -Bw Brianvarskonst/ruleset.xml <(xmllint --format Brianvarskonst/ruleset.xml)
- run: diff -Bw <(./bin/normalize.sh Brianvarskonst/ruleset.xml) <(./bin/normalize.sh <(xmllint --format Brianvarskonst/ruleset.xml))
- run: diff -Bw phpcs.brianvarskonst.xml <(xmllint --format phpcs.brianvarskonst.xml)
- run: diff -Bw phpcs.xml.dist <(xmllint --format phpcs.xml.dist)
- name: Stylecheck against Brianvarskonst itself
Expand Down
10 changes: 10 additions & 0 deletions bin/normalize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
normalize() {
xmllint --format "$1" |
sed -e 's/>\s*</></g' \
-e 's/\s\+/ /g' \
-e 's/^ *//' \
-e 's/ *$//'
}

normalize "$1"

0 comments on commit 9ae0f6d

Please sign in to comment.