From c4aa6aab9174a22d3fd4fd801df84a766e6d9dc6 Mon Sep 17 00:00:00 2001 From: Chauncey McAskill Date: Tue, 23 Jul 2019 20:00:57 -0400 Subject: [PATCH] Support for JSON Linting (#6) * Fix Composer script 'phplint' Fixed: - Syntax for multiple starting points - Match only regular PHP files * Add Composer script 'jsonlint' For linting metadata files. Added: - Composer package 'seld/jsonlint' - Composer script 'jsonlint' Changed: - Execute 'jsonlint' in Travis --- .travis.yml | 1 + composer.json | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 46ce529..cefc616 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ install: - mkdir -p build/logs/ script: + - composer jsonlint - composer phplint - composer phpcs - composer phpunit -- --coverage-clover "build/logs/clover.xml" diff --git a/composer.json b/composer.json index 568b18d..96ec3eb 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,7 @@ "phpunit/phpunit": "^5.7 || ^6.5", "squizlabs/php_codesniffer": "^3.0", "php-coveralls/php-coveralls": "^2.0", + "seld/jsonlint": "^1.7", "cache/void-adapter": "^0.3.1", "tedivm/stash": "~0.14", "pimple/pimple": "^3.0" @@ -47,10 +48,12 @@ "@tests" ], "tests": [ + "@jsonlint", "@phplint", "@phpcs", "@phpunit" ], + "jsonlint": "find metadata tests -type f -name '*.json' -print0 | xargs -0 -n1 -P8 vendor/bin/jsonlint | grep -v '^Valid JSON'; test $? -eq 1", "phplint": "find src tests -type f -name '*.php' -print0 | xargs -0 -n1 -P8 php -l | grep -v '^No syntax errors detected'; test $? -eq 1", "phpcs": "php vendor/bin/phpcs -ps --colors src/ tests/", "phpcbf": "php vendor/bin/phpcbf -ps --colors src/ tests/",