Skip to content

Commit

Permalink
Enhancement: Run static code analysis with vimeo/psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Apr 28, 2022
1 parent 95a1044 commit e117540
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,32 @@ jobs:
- name: "Run maglnet/composer-require-checker"
run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json"

static-code-analysis:
name: "Static Code Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"

- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Install dependencies with composer"
run: "composer install --ansi --no-progress"

- name: "Run vimeo/psalm"
run: ".phive/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4"

tests:
name: "Tests"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.build/
/vendor/
/.php-cs-fixer.cache
/.phpunit.result.cache
Expand Down
1 change: 1 addition & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.8.0" installed="3.8.0" location="./.phive/php-cs-fixer" copy="true"/>
<phar name="composer-require-checker" version="^3.8.0" installed="3.8.0" location="./.phive/composer-require-checker" copy="true"/>
<phar name="psalm" version="^4.22.0" installed="4.22.0" location="./.phive/psalm" copy="true"/>
</phive>
Binary file added .phive/psalm
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Integrate](https://github.com/friendsoftwig/twigcs/workflows/Integrate/badge.svg)](https://github.com/friendsoftwig/twigcs/actions)

[![Code Coverage](https://codecov.io/github/friendsoftwig/twigcs/branch/main/graph/badge.svg)](https://codecov.io/github/friendsoftwig/twigcs)
[![Type Coverage](https://shepherd.dev/github/friendsoftwig/twigcs/coverage.svg)](https://shepherd.dev/github/friendsoftwig/twigcs)

The missing checkstyle for twig!

Expand Down
2 changes: 2 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@" />
19 changes: 19 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
cacheDirectory=".build/psalm"
errorBaseline="psalm-baseline.xml"
errorLevel="1"
findUnusedVariablesAndParams="true"
resolveFromConfigFile="true"
strictBinaryOperands="true"
>
<projectFiles>
<directory name="src/" />
<ignoreFiles>
<directory name="vendor/" />
</ignoreFiles>
</projectFiles>
</psalm>

0 comments on commit e117540

Please sign in to comment.