-
Notifications
You must be signed in to change notification settings - Fork 1k
chore: add PHP codesniffer and fix errors/warnings #1770
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
base: main
Are you sure you want to change the base?
Conversation
rsamborski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved for compute and security products. Before merging please update CONTRIBUTING.md to explain how to run the sniffer locally before submitting changes.
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '7.4' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| php-version: '7.4' | |
| php-version: '8.1' |
| name: PHP CS Fixer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Install PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '8.2' | ||
|
|
||
| - name: Run Script | ||
| run: testing/run_cs_check.sh | ||
|
|
||
| staticanalysis: | ||
| php_code_sniffer: | ||
| name: PHP Code Sniffer | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '7.4' | ||
| - name: Install Dependencies | ||
| uses: nick-invision/retry@v2 | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 3 | ||
| command: composer global require squizlabs/php_codesniffer | ||
| - name: Run PHPCS Code Style Checker | ||
| run: ~/.composer/vendor/bin/phpcs --standard=phpcs-ruleset.xml -p -s | ||
|
|
||
| phpstan_static_analysis: | ||
| name: PHPStan Static Analysis | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
.github/workflows/lint.yml
Outdated
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Add linter for PHPCS, which checks for line lengths and found multiple other whitespace issues.
PHP CS Fixer (the existing checker) does not do a good job with whitespace (and in some cases, doesn't do the job at all). For this reason, it's better to run both linters.