Skip to content

Commit

Permalink
Merge pull request #200 from PHPCSStandards/develop
Browse files Browse the repository at this point in the history
Release PHPCSExtra 1.0.0
  • Loading branch information
jrfnl committed Jan 4, 2023
2 parents e0e58d3 + fcd8cb5 commit 5ab4e9e
Show file tree
Hide file tree
Showing 15 changed files with 242 additions and 88 deletions.
21 changes: 12 additions & 9 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
# https://www.reddit.com/r/PHP/comments/2jzp6k/i_dont_need_your_tests_in_my_production
# https://blog.madewithlove.be/post/gitattributes/
#
/.coveralls.yml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github/ export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/phpunit-bootstrap.php export-ignore
/Modernize/Tests/ export-ignore
.coveralls.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.remarkignore export-ignore
.remarkrc export-ignore
.yamllint.yml export-ignore
phpcs.xml.dist export-ignore
phpunit.xml.dist export-ignore
phpunit-bootstrap.php export-ignore
/.github/ export-ignore
/Modernize/Tests/ export-ignore
/NormalizedArrays/Tests/ export-ignore
/Universal/Tests/ export-ignore
/Universal/Tests/ export-ignore

#
# Auto detect text files and perform LF normalization
Expand Down
27 changes: 27 additions & 0 deletions .github/release-checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Template to use for release PRs from `develop` to `stable`

PR for tracking changes for the x.x.x release. Target release date: **DOW MONTH DAY YEAR**.

## Release checklist

### General

- [ ] Verify, and if necessary, update the allowed version ranges for various dependencies in the `composer.json` - PR #xxx
- [ ] Add changelog for the release - PR #xxx
:pencil2: Remember to add a release link at the bottom!
- [ ] Update sniff list in `README` (if applicable) - PR #xxx.

### Release

- [ ] Merge this PR
- [ ] Make sure all CI builds are green.
- [ ] Tag and create a release (careful, GH defaults to `develop`!) & copy & paste the changelog to it.
:pencil2: Don't forget to copy the link collection from the bottom of the changelog!
- [ ] Make sure all CI builds are green.
- [ ] Close the milestone
- [ ] Open a new milestone for the next release
- [ ] If any open PRs/issues which were milestoned for this release did not make it into the release, update their milestone.
- [ ] Fast-forward `develop` to be equal to `master`

### Publicize
- [ ] Tweet about the release.
90 changes: 84 additions & 6 deletions .github/workflows/basics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
coverage: none
tools: cs2pr

# 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

- name: 'Composer: adjust dependencies'
run: |
# The sniff stage doesn't run the unit tests, so no need for PHPUnit.
Expand All @@ -49,8 +54,8 @@ jobs:
- 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")
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Install xmllint
run: |
Expand Down Expand Up @@ -92,7 +97,80 @@ jobs:
- 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
remark:
name: 'QA Markdown'
runs-on: ubuntu-latest

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

- name: Set up node and enable caching of dependencies
uses: actions/setup-node@v3
with:
node-version: '16'

# To make the command available on CLI, it needs to be installed globally.
- name: Install Remark CLI globally
run: npm install --global remark-cli --foreground-scripts true --fund false

# To allow for creating a custom config which references rules which are included
# in the presets, without having to install all rules individually, a local install
# works best (and installing the presets in the first place, of course).
#
# Note: the first group of packages are all part of the mono "Remark lint" repo.
# The second group of packages (heading-whitespace and down) are additional
# "external" rules/plugins.
- name: Install Remark rules locally
run: >
npm install --foreground-scripts true --fund false
remark-lint
remark-gfm
remark-preset-lint-consistent
remark-preset-lint-recommended
remark-preset-lint-markdown-style-guide
remark-lint-checkbox-content-indent
remark-lint-linebreak-style
remark-lint-no-duplicate-defined-urls
remark-lint-no-empty-url
remark-lint-no-heading-like-paragraph
remark-lint-no-reference-like-url
remark-lint-no-unneeded-full-reference-image
remark-lint-no-unneeded-full-reference-link
remark-lint-strikethrough-marker
remark-lint-heading-whitespace
remark-lint-list-item-punctuation
remark-lint-match-punctuation
remark-lint-no-hr-after-heading
remark-lint-are-links-valid-alive
remark-lint-are-links-valid-duplicate
remark-validate-links
- name: Run Remark-lint
run: remark . --frail

# @link https://github.com/reviewdog/action-remark-lint
- name: Show Remark-lint annotations in PR
if: ${{ failure() && github.event_name == 'pull_request' }}
uses: reviewdog/action-remark-lint@v5
with:
fail_on_error: true
install_deps: false
level: info
reporter: github-pr-check

yamllint:
name: 'Lint Yaml'
runs-on: ubuntu-latest

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

# Ref: https://yamllint.readthedocs.io/en/stable/
- name: Run Yamllint on all yaml files in repo
run: yamllint . --format colored

- name: Pipe Yamllint results on to GH for inline display
if: ${{ failure() }}
run: yamllint . --format github
8 changes: 4 additions & 4 deletions .github/workflows/quicktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ jobs:
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")
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

# For the PHP "latest", we need to install with ignore platform reqs as not all PHPUnit 7.x dependencies allow it.
# For 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")
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Lint against parse errors
if: matrix.phpcs_version == 'dev-master'
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ jobs:
# @link https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
#
# The matrix is set up so as not to duplicate the builds which are run for code coverage.
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '8.0', '8.1', '8.2']
php: ['5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '8.0', '8.1', '8.2', '8.3']
phpcs_version: ['3.7.1', 'dev-master']

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

continue-on-error: ${{ matrix.php == '8.3' }}

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -68,16 +70,16 @@ jobs:
if: ${{ startsWith( matrix.php, '8' ) == false }}
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")
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

# For the PHP 8/"nightly", we need to install with ignore platform reqs as we're still using PHPUnit 7.
- name: Install Composer dependencies - with ignore platform
if: ${{ startsWith( matrix.php, '8' ) }}
uses: "ramsey/composer-install@v2"
with:
composer-options: --ignore-platform-reqs
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Lint against parse errors
if: matrix.phpcs_version == 'dev-master'
Expand Down Expand Up @@ -144,8 +146,8 @@ jobs:
- 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")
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")

- name: Lint against parse errors
if: matrix.phpcs_version == 'dev-master'
Expand Down
5 changes: 5 additions & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore rules for Remark.
# Docs: https://github.com/unifiedjs/unified-engine/blob/HEAD/doc/ignore.md

/node_modules/
/vendor/
36 changes: 36 additions & 0 deletions .remarkrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"plugins": [
"remark-gfm",
["remark-lint-checkbox-character-style", "consistent"],
["remark-lint-checkbox-content-indent", "consistent"],
"remark-lint-definition-spacing",
"remark-lint-file-extension",
["remark-lint-linebreak-style", "unix"],
["remark-lint-link-title-style", "\""],
["remark-lint-ordered-list-marker-style", "."],
"remark-lint-no-duplicate-defined-urls",
"remark-lint-no-duplicate-definitions",
"remark-lint-no-empty-url",
"remark-lint-no-file-name-consecutive-dashes",
"remark-lint-no-file-name-irregular-characters",
"remark-lint-no-file-name-outer-dashes",
"remark-lint-no-heading-like-paragraph",
"remark-lint-no-literal-urls",
"remark-lint-no-reference-like-url",
"remark-lint-no-shortcut-reference-image",
"remark-lint-no-table-indentation",
"remark-lint-no-undefined-references",
"remark-lint-no-unneeded-full-reference-image",
"remark-lint-no-unneeded-full-reference-link",
"remark-lint-no-unused-definitions",
["remark-lint-strikethrough-marker", "~~"],
["remark-lint-table-cell-padding", "consistent"],
"remark-lint-heading-whitespace",
"remark-lint-list-item-punctuation",
"remark-lint-match-punctuation",
"remark-lint-no-hr-after-heading",
"remark-lint-are-links-valid-alive",
"remark-lint-are-links-valid-duplicate",
"remark-validate-links"
]
}
22 changes: 22 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Details on the default config:
# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
extends: default

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

# Rule documentation: https://yamllint.readthedocs.io/en/stable/rules.html
rules:
colons:
max-spaces-after: -1 # Disabled to allow aligning of values.
comments:
min-spaces-from-content: 1
comments-indentation: {}
document-start:
present: false
line-length:
max: 145
truthy:
allowed-values: ["true", "false", "on", "off"]
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,38 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
_Nothing yet._


## [1.0.0] - 2023-01-04

:warning: Important: this package now requires [PHPCSUtils 1.0.0]. Please make sure you use `--with-[all-]dependencies` when running `composer update`. :exclamation:

For the full list of features, please see the changelogs of the alpha/rc releases:
* [1.0.0-rc1](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-rc1)
* [1.0.0-alpha3](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-alpha3)
* [1.0.0-alpha2](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-alpha2)
* [1.0.0-alpha1](https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.0.0-alpha1)

### Changed

#### Other

* Updated various sniffs to take advantage of PHPCSUtils 1.0.0(-rc1). [#193], [#194], [#195]
* Minor documentation improvements.
* Various housekeeping.

### Fixed

#### Modernize

* `Modernize.FunctionCalls.Dirname`: the sniff will now correctly recognize magic constants in a case-insensitive manner. [#187]

[PHPCSUtils 1.0.0]: https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.0.0

[#187]: https://github.com/PHPCSStandards/PHPCSExtra/pull/187
[#193]: https://github.com/PHPCSStandards/PHPCSExtra/pull/193
[#194]: https://github.com/PHPCSStandards/PHPCSExtra/pull/194
[#195]: https://github.com/PHPCSStandards/PHPCSExtra/pull/195


## [1.0.0-RC1] - 2022-12-07

:warning: Important: this package now requires [PHPCSUtils 1.0.0-alpha4]. Please make sure you use `--with-[all-]dependencies` when running `composer update`. :exclamation:
Expand Down Expand Up @@ -137,6 +169,7 @@ The upgrade to PHPCSUtils 1.0.0-alpha4 took care of a number of bugs, which pote
[#128]: https://github.com/PHPCSStandards/PHPCSExtra/pull/128
[#130]: https://github.com/PHPCSStandards/PHPCSExtra/pull/130
[#134]: https://github.com/PHPCSStandards/PHPCSExtra/pull/134
[#135]: https://github.com/PHPCSStandards/PHPCSExtra/pull/135
[#137]: https://github.com/PHPCSStandards/PHPCSExtra/pull/137
[#140]: https://github.com/PHPCSStandards/PHPCSExtra/pull/140
[#142]: https://github.com/PHPCSStandards/PHPCSExtra/pull/142
Expand Down Expand Up @@ -342,6 +375,7 @@ This initial alpha release contains the following sniffs:
[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer

[Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD
[1.0.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-rc1...1.0.0
[1.0.0-RC1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha3...1.0.0-rc1
[1.0.0-alpha3]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha2...1.0.0-alpha3
[1.0.0-alpha2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.0-alpha1...1.0.0-alpha2
Expand Down
2 changes: 1 addition & 1 deletion Modernize/Sniffs/FunctionCalls/DirnameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function process(File $phpcsFile, $stackPtr)
/*
* PHP 5.3+: Detect use of dirname(__FILE__).
*/
if ($pathParam['clean'] === '__FILE__') {
if (\strtoupper($pathParam['clean']) === '__FILE__') {
// Determine if the issue is auto-fixable.
$hasComment = $phpcsFile->findNext(Tokens::$commentTokens, ($opener + 1), $closer);
$fixable = ($hasComment === false);
Expand Down
6 changes: 3 additions & 3 deletions Modernize/Tests/FunctionCalls/DirnameUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $path = dirname(\dirname(__DIR__) . '/file.php'); // Nested dirname() call not s
* These should be flagged for use of dirname(__FILE__).
*/
$path = dirname(__FILE__);
$path = \dirname ( __FILE__ , ) ; // Includes trailing comma.
$path = \dirname ( __file__ , ) ; // Includes trailing comma.

$path = DirName(__FILE__ /* todo: replace with __DIR__ */); // Not auto-fixable.

Expand All @@ -70,7 +70,7 @@ $path = dirname(path: __FILE__, levels: 1);
$path = dirname(levels: 3, path: __FILE__);

// phpcs:ignore Modernize.FunctionCalls.Dirname.Nested -- Only apply __DIR__ fix, not $levels.
$path = dirname(dirname(dirname(dirname(__FILE__))));
$path = dirname(dirname(dirname(dirname(__file__))));


/*
Expand Down Expand Up @@ -129,7 +129,7 @@ $path = dirname(
levels: 2,
path: dirname(
path: dirname(
path: __FILE__
path: __file__
),
levels: 3,
)
Expand Down
Loading

0 comments on commit 5ab4e9e

Please sign in to comment.