Use psalm for static analysis

Don't check the main Parsedown file just yet
This commit is contained in:
Aidan Woods 2018-12-05 11:33:37 +01:00
parent f6a845fa52
commit 57b86b3fc4
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
3 changed files with 19 additions and 1 deletions

View File

@ -26,7 +26,7 @@ matrix:
install: install:
# remove packages with PHP requirements higher than 7.0 to prevent composer trying to resolve these, see: https://github.com/composer/composer/issues/6011 # remove packages with PHP requirements higher than 7.0 to prevent composer trying to resolve these, see: https://github.com/composer/composer/issues/6011
- composer remove friendsofphp/php-cs-fixer --dev --no-update --no-interaction - composer remove vimeo/psalm friendsofphp/php-cs-fixer --dev --no-update --no-interaction
- composer install --prefer-dist --no-interaction --no-progress - composer install --prefer-dist --no-interaction --no-progress
script: composer test-units script: composer test-units
@ -42,6 +42,7 @@ jobs:
install: composer install --prefer-dist --no-interaction --no-progress install: composer install --prefer-dist --no-interaction --no-progress
script: script:
- '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"vendor/autoload.php\"); echo Erusev\Parsedown\Parsedown::version;")" ]' - '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"vendor/autoload.php\"); echo Erusev\Parsedown\Parsedown::version;")" ]'
- composer test-static
- composer test-formatting - composer test-formatting
- stage: Test CommonMark (weak) - stage: Test CommonMark (weak)

View File

@ -18,6 +18,7 @@
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7.4|^6.5.13|^5.7.27|^4.8.36", "phpunit/phpunit": "^7.4|^6.5.13|^5.7.27|^4.8.36",
"vimeo/psalm": "^3.0",
"friendsofphp/php-cs-fixer": "^2.13" "friendsofphp/php-cs-fixer": "^2.13"
}, },
"autoload": { "autoload": {
@ -28,9 +29,12 @@
}, },
"scripts": { "scripts": {
"test": [ "test": [
"@test-static",
"@test-units", "@test-units",
"@test-formatting" "@test-formatting"
], ],
"test-static": "vendor/bin/psalm",
"test-dead-code": "vendor/bin/psalm --find-dead-code",
"test-units": "vendor/bin/phpunit", "test-units": "vendor/bin/phpunit",
"test-commonmark-weak": "vendor/bin/phpunit tests/CommonMarkTestWeak.php", "test-commonmark-weak": "vendor/bin/phpunit tests/CommonMarkTestWeak.php",
"test-formatting": "@composer fix -- --dry-run", "test-formatting": "@composer fix -- --dry-run",

13
psalm.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<psalm
totallyTyped="true"
strictBinaryOperands="true"
checkForThrowsDocblock="true"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<file name="src/Parsedown.php" />
</ignoreFiles>
</projectFiles>
</psalm>