-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add static analysis (PHPCS + PHPStan) and CI #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
54d0778
chore: add composer setup with phpcs, phpstan and CI static analysis
YvesCesar cd3e4f5
fix: escape output and sanitize request input flagged by phpcs
YvesCesar 7d697a2
fix: harden request input handling and declare the php requirement
YvesCesar f3081c7
ci: run each check in its own workflow
YvesCesar 54e033b
ci: name each workflow after the tool it runs
YvesCesar 01a8f7e
ci: drop php 8.1 from the check matrix
YvesCesar 3f211ea
chore: require php 8.3 and wordpress 7.0
YvesCesar 4fde3e8
ci: derive the php matrix from composer.json
YvesCesar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: PHP Lint | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| php-matrix: | ||
| name: PHP matrix | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| versions: ${{ steps.php-matrix.outputs.versions }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: typisttech/php-matrix-action@v3 | ||
| id: php-matrix | ||
|
|
||
| php-lint: | ||
| name: PHP Lint (PHP ${{ matrix.php }}) | ||
| needs: php-matrix | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ${{ fromJSON(needs.php-matrix.outputs.versions) }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| coverage: none | ||
| tools: composer | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
|
|
||
| - run: composer lint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: PHPCS | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| php-matrix: | ||
| name: PHP matrix | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| versions: ${{ steps.php-matrix.outputs.versions }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: typisttech/php-matrix-action@v3 | ||
| id: php-matrix | ||
|
|
||
| phpcs: | ||
| name: PHPCS (PHP ${{ matrix.php }}) | ||
| needs: php-matrix | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ${{ fromJSON(needs.php-matrix.outputs.versions) }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| coverage: none | ||
| tools: composer | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
|
|
||
| - run: composer cs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: PHPStan | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| php-matrix: | ||
| name: PHP matrix | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| versions: ${{ steps.php-matrix.outputs.versions }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: typisttech/php-matrix-action@v3 | ||
| id: php-matrix | ||
|
|
||
| phpstan: | ||
| name: PHPStan (PHP ${{ matrix.php }}) | ||
| needs: php-matrix | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php: ${{ fromJSON(needs.php-matrix.outputs.versions) }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| coverage: none | ||
| tools: composer | ||
|
|
||
| - uses: ramsey/composer-install@v3 | ||
|
|
||
| - run: composer stan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /vendor/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "name": "libresign/libresign-wp-customizations", | ||
| "description": "WordPress customizations for libresign.coop", | ||
| "type": "wordpress-plugin", | ||
| "license": "GPL-2.0-or-later", | ||
| "require": { | ||
| "php": ">=8.3 <8.6" | ||
| }, | ||
| "require-dev": { | ||
| "dealerdirect/phpcodesniffer-composer-installer": "^1.0", | ||
| "php-parallel-lint/php-parallel-lint": "^1.4", | ||
| "php-stubs/woocommerce-stubs": "^9.0", | ||
| "phpcompatibility/phpcompatibility-wp": "^2.1", | ||
| "phpstan/phpstan": "^2.1", | ||
| "squizlabs/php_codesniffer": "^3.13", | ||
| "szepeviktor/phpstan-wordpress": "^2.0", | ||
| "wp-coding-standards/wpcs": "^3.2" | ||
| }, | ||
| "config": { | ||
| "allow-plugins": { | ||
| "dealerdirect/phpcodesniffer-composer-installer": true | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "lint": "parallel-lint --exclude vendor .", | ||
| "cs": "phpcs", | ||
| "cs:fix": "phpcbf", | ||
| "stan": "phpstan analyse", | ||
| "ci": [ | ||
| "@lint", | ||
| "@cs", | ||
| "@stan" | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.