Skip to content

Commit 3a70377

Browse files
committedApr 18, 2023
add linters
1 parent c30969f commit 3a70377

File tree

5 files changed

+177
-3
lines changed

5 files changed

+177
-3
lines changed
 

‎.github/workflow/lint.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: lint
2+
3+
on: pull_request
4+
5+
jobs:
6+
phpcs:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: shivammathur/setup-php@v2
11+
- run: composer install --prefer-dist
12+
- name: do
13+
run: ./vendor/bin/phpcs --report=emacs --standard=phpcs.xml ./ | reviewdog -reporter=github-pr-review -efm='%f:%l:%c:%m'
14+
- name: try autofix
15+
run: ./vendor/bin/phpcbf --standard=phpcs.xml ./
16+
- name: suggester / phpcs
17+
uses: reviewdog/action-suggester@v1
18+
with:
19+
tool_name: phpcs
20+
21+
phpstan:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
- uses: shivammathur/setup-php@v2
26+
- run: composer install --prefer-dist
27+
- name: do
28+
run: ./vendor/bin/phpstan analyse --error-format=raw --no-progress | reviewdog -reporter=github-pr-review -f=phpstan

‎composer.json

+8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@
66
"email": "sters@users.noreply.github.com"
77
}
88
],
9+
"scripts":{
10+
"phpcs": "phpcs --report=emacs --standard=phpcs.xml ./",
11+
"phpstan": "phpstan analyse --error-format=raw --no-progress"
12+
},
913
"autoload": {
1014
"psr-4": {
1115
"ClassGraph\\": "src"
1216
}
1317
},
1418
"require": {
1519
"nikic/php-parser": "^4.2"
20+
},
21+
"require-dev": {
22+
"phpstan/phpstan": "^1.10",
23+
"squizlabs/php_codesniffer": "^3.7"
1624
}
1725
}

‎composer.lock

+124-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎phpcs.xml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PSR12">
3+
<arg name="extensions" value="php" />
4+
<rule ref="PSR12" />
5+
6+
<exclude-pattern>*/examples/*</exclude-pattern>
7+
<exclude-pattern>*/testcase/*</exclude-pattern>
8+
<exclude-pattern>*/vendor/*</exclude-pattern>
9+
</ruleset>

‎phpstan.neon

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
level: 0
3+
paths:
4+
- .
5+
excludePaths:
6+
- vendor/*
7+
- testcase/*
8+
- examples/*

0 commit comments

Comments
 (0)
Please sign in to comment.