Skip to content

Commit

Permalink
Merge pull request #184 from PHPCSStandards/develop
Browse files Browse the repository at this point in the history
Release version 1.0.-RC1
  • Loading branch information
jrfnl committed Dec 7, 2022
2 parents a8415f9 + 2dc1d34 commit e0e58d3
Show file tree
Hide file tree
Showing 265 changed files with 13,722 additions and 995 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
coverage_clover: build/logs/clover.xml
json_path: build/logs/coveralls-upload.json
service_name: travis-ci
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
/.coveralls.yml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.github/ export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/phpunit-bootstrap.php export-ignore
/Modernize/Tests/ export-ignore
/NormalizedArrays/Tests/ export-ignore
/Universal/Tests/ export-ignore

Expand Down
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: "\U0001F41B Bug report for sniffs"
about: I got unexpected behavior and think it is a bug.

---

<!--
PLEASE FILL OUT THE TEMPLATE COMPLETELY.
BUG REPORTS WHICH CANNOT BE REPRODUCED BASED ON THE INFORMATION PROVIDED WILL BE CLOSED.
-->

## Bug Description
<!-- Provide a clear and concise description of the problem you are experiencing. -->


## Given the following reproduction Scenario
<!-- Please provide example code that allows us to reproduce the issue. Do NOT paste screenshots of code! -->

The issue happens when running this command:
<!-- Adjust the below command as appropriate. -->
```bash
phpcs -ps file.php --standard=...
```

... over a file containing this code:
```php
// Place your code sample here.
```

<!-- Optionally post a *minimal* version of your custom ruleset here if needed to reproduce the issue. -->
... with this custom ruleset:
```xml
<?xml version="1.0"?>
<ruleset name="My Custom Standard">
...
</ruleset>
```


### I'd expect the following behaviour
<!-- What was the expected (correct) behavior? -->


### Instead this happened
<!--
What is the current (buggy) behavior?
Please provide as much information as possible and relevant.
Whenever possible, include the error message and the error code for the sniff that is being
(or should have been) triggered.
You can see the sniff error codes by running `phpcs` with the `-s` flag.
Example: `Universal.Arrays.DuplicateArrayKey.Found`
-->


## Environment
<!--
Please include as many details as relevant about the environment you experienced the bug in.
You should be able to get the version numbers using the `composer info` command.
-->

| Environment | Answer
| ------------------------ | -------
| PHP version | x.y.z
| PHP_CodeSniffer version | x.y.z
| PHPCSExtra version | x.y.z
| PHPCSUtils version | x.y.z
| Install type | e.g. Composer global, Composer project local, git clone, other (please expand)


## Additional Context (optional)
<!-- Add any other context about the problem here. -->


## Tested Against `develop` branch?
- [ ] I have verified the issue still exists in the `develop` branch of PHPCSExtra.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "\U0001F680 Feature request"
about: I have a suggestion (and may want to implement it).
---

## Is your feature request related to a problem?
<!-- Please provide a clear and concise description of what the feature is which you'd like to see implemented. -->

## Describe the solution you'd like
<!--
A clear and concise description of what you want to happen.
Please include some code samples of what should be flagged and preferably also some
code samples of what should *not* be flagged.
-->

## Additional context (optional)
<!-- Add any other context or screenshots about the feature request here. -->

- [ ] I intend to create a pull request to implement this feature.
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependabot configuration.
#
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5 # Set to 0 to (temporarily) disable.
versioning-strategy: widen
commit-message:
prefix: "Composer:"
labels:
- "Type: chores/QA"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 5
commit-message:
prefix: "GH Actions:"
labels:
- "Type: chores/QA"
98 changes: 98 additions & 0 deletions .github/workflows/basics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CS

on:
# Run on all pushes and on all pull requests.
# Prevent the build from running when there are only irrelevant changes.
push:
paths-ignore:
- '**.md'
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
checkcs:
name: 'Basic CS and QA checks'
runs-on: ubuntu-latest

env:
XMLLINT_INDENT: ' '
# - COMPOSER_ROOT_VERSION is needed to get round the recursive dependency when using CI.
COMPOSER_ROOT_VERSION: '1.99.99'

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

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none
tools: cs2pr

- name: 'Composer: adjust dependencies'
run: |
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
composer remove --no-update --dev phpunit/phpunit --no-scripts --no-interaction
# Using PHPCS `master` as an early detection system for bugs upstream.
composer require --no-update squizlabs/php_codesniffer:"dev-master" --no-interaction
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

- name: Install xmllint
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y libxml2-utils
# Show XML violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- uses: korelstar/xmllint-problem-matcher@v1

# Validate the Ruleset XML file.
# @link http://xmlsoft.org/xmllint.html
- name: Validate rulesets against schema
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml

# Check the code-style consistency of the XML ruleset files.
- name: Check XML code style
run: |
diff -B ./Modernize/ruleset.xml <(xmllint --format "./Modernize/ruleset.xml")
diff -B ./NormalizedArrays/ruleset.xml <(xmllint --format "./NormalizedArrays/ruleset.xml")
diff -B ./Universal/ruleset.xml <(xmllint --format "./Universal/ruleset.xml")
# Validate the Documentation XML files.
- name: Validate documentation against schema
run: xmllint --noout --schema vendor/phpcsstandards/phpcsdevtools/DocsXsd/phpcsdocs.xsd ./*/Docs/*/*Standard.xml

# Check the code-style consistency of the PHP files.
- name: Check PHP code style
id: phpcs
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml

- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml

# Check that the sniffs available are feature complete.
# For now, just check that all sniffs have unit tests.
# At a later stage the documentation check can be activated.
- name: Check sniff feature completeness
run: composer check-complete

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict
88 changes: 88 additions & 0 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Quicktest

on:
# Run on pushes, including merges, to all branches except for `stable` and `develop`.
push:
branches-ignore:
- stable
- develop
paths-ignore:
- '**.md'
# Allow manually triggering the workflow.
workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
#### QUICK TEST STAGE ####
# This is a much quicker test which only runs the unit tests and linting against the low/high
# supported PHP/PHPCS combinations.
# These are basically the same builds as in the Test->Coverage workflow, but then without doing
# the code-coverage.
quicktest:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', 'latest']
phpcs_version: ['3.7.1', 'dev-master']

name: "QTest${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"

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

# On stable PHPCS versions, allow for PHP deprecation notices.
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
- name: Setup ini config
id: set_ini
run: |
if [ "${{ matrix.phpcs_version }}" != "dev-master" ]; then
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> $GITHUB_OUTPUT
else
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> $GITHUB_OUTPUT
fi
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
coverage: none

- name: 'Composer: set PHPCS version for tests'
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-interaction

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: matrix.php != 'latest'
uses: "ramsey/composer-install@v2"
with:
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

# For the PHP "latest", we need to install with ignore platform reqs as not all PHPUnit 7.x dependencies allow it.
- name: Install Composer dependencies - with ignore platform
if: matrix.php == 'latest'
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")

- name: Lint against parse errors
if: matrix.phpcs_version == 'dev-master'
run: composer lint

- name: Run the unit tests - PHP 5.4 - 8.0
if: matrix.php != 'latest'
run: composer test

- name: Run the unit tests - PHP > 8.1
if: matrix.php == 'latest'
run: composer test -- --no-configuration --bootstrap=phpunit-bootstrap.php --dont-report-useless-tests
Loading

0 comments on commit e0e58d3

Please sign in to comment.