Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qa: Adds XML linter #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ matrix:
- LEGACY_DEPS="phpunit/phpunit"
- CS_CHECK=true
- TEST_COVERAGE=true
- XMLLINT=true
addons:
apt:
packages:
- libxml2-utils
- php: 7.1
env:
- DEPS=latest
Expand Down Expand Up @@ -67,6 +72,7 @@ install:
script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
- if [[ $XMLLINT == 'true' ]]; then test/xmllint.sh ; fi

after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi
Expand Down
2 changes: 1 addition & 1 deletion ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<ruleset name="Webimpress Coding Standard">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WebimpressCodingStandard" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<rule ref="vendor/webimpress/coding-standard/src/WebimpressCodingStandard/ruleset.xml"/>
</ruleset>
4 changes: 1 addition & 3 deletions src/WebimpressCodingStandard/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0"?>
<ruleset name="Webimpress Coding Standard"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd">
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WebimpressCodingStandard" xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Webimpress Coding Standard</description>

<!-- display progress -->
Expand Down
18 changes: 18 additions & 0 deletions test/xmllint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

RULESET="src/WebimpressCodingStandard/ruleset.xml"
LOCAL="ruleset.xml"

set -e

wget -nv -N -P tmp/ "https://github.com/squizlabs/PHP_CodeSniffer/raw/master/phpcs.xsd"
wget -nv -N -P tmp/ "https://www.w3.org/2012/04/XMLSchema.xsd"

xmllint --noout --schema tmp/XMLSchema.xsd tmp/phpcs.xsd
xmllint --noout --schema tmp/phpcs.xsd "$RULESET"
diff -B "$RULESET" <(XMLLINT_INDENT=" " xmllint --format "$RULESET")

xmllint --noout --schema tmp/phpcs.xsd "$LOCAL"
diff -B "$LOCAL" <(XMLLINT_INDENT=" " xmllint --format "$LOCAL")

rm -Rf tmp/