Skip to content

Conversation

@bshaffer
Copy link
Contributor

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.

@bshaffer bshaffer requested review from a team and rsamborski as code owners January 24, 2023 00:48
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jan 24, 2023
Copy link
Member

@rsamborski rsamborski left a 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'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
php-version: '7.4'
php-version: '8.1'

@bshaffer bshaffer requested review from a team as code owners December 2, 2025 00:47
Comment on lines 10 to 22
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

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +23 to +40
- 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

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines 41 to 59

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants