Skip to content
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

1.0.0-alpha1 #16

Merged
merged 38 commits into from
Jan 23, 2020
Merged

1.0.0-alpha1 #16

merged 38 commits into from
Jan 23, 2020

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 23, 2020

No description provided.

jrfnl and others added 30 commits January 23, 2020 03:55
Sister-sniff to the PHPCS native `Generic.Arrays.DisallowShortArraySyntax` sniffs to disallow the use of short lists.

Includes fixer.
Includes unit tests.
Includes documentation.

Includes partial metrics. Combine this sniff with the `Universal.Lists.DisallowLongListSyntax` sniff to get the full picture.
Sister-sniff to the PHPCS native `Generic.Arrays.DisallowLongArraySyntax` and the `Universal.Lists.DisallowShortListSyntax` sniffs to disallow the use of long lists.

Includes fixer.
Includes unit tests.
Includes documentation.

Includes partial metrics. Combine this sniff with the `Universal.Lists.DisallowShortListSyntax` sniff to get the full picture.
This:
* Adds a custom PHPCS ruleset which uses the `PHPCSDev` ruleset to check the code style of code in this repo, with a few, very select, exclusions.
* Adds convenience scripts to the `composer.json` file to check the code of the repo.
* And allows for individual developers to overload the `phpcs.xml.dist` file by ignoring the typical overload files.

**Important notes**:
For the time being - until v 1.0.0 has been tagged for the `PHPCSDevTools` package -, the `require` will use the `dev-develop` branch of `PHPCSDevTools`.

Also, the `composer validate` check doesn't need to be run on every build. Running it on just one build is sufficient, so moving it to the `sniff` stage.
The `PHPCSDevTools` repo offers a script to check that all sniffs are "feature complete", i.e. are accompanied by documentation in `..Standard.xml` format, as well as unit tests.

This check is now enabled.
This:
* Adds a PHPUnit `phpunit.xml.dist` configuration file.
* Adds a `phpunit-bootstrap.php` file to load the necessary prerequisites for the unit testing.
* Adds convenience script to the `composer.json` file to run the unit tests for the repo.
* Adds the necessary changes to the Travis script to test against the relevant PHP / PHPCS combinations.
    Includes moving the build against `nightly` to the `test` stage to allow it to lint files. The `PHPCS_VERSION` has been set to `n/a` to skip unit testing (for now).
* And allow for individual developers to overload the `phpunit.xml.dist` file by ignoring the typical overload files.

Other tweaks included:
* Moving the `composer install` to the Travis `install` step and skipping that step for the `sniff` stage as we don't need a full composer install for that stage.
…lowlonglistsyntax-disallowshortlistsyntax-sniffs

New DisallowShortListSyntax and DisallowLongListSyntax sniffs (includes QA setup)
New sniff to disallow the alternative namespace syntax using curly braces:
```php
namespace Vendor\Project {
    // Code...
}
```

Includes unit tests.
Includes documentation.
Includes metrics.
New sniff to enforce using the alternative namespace syntax using curly braces:
```php
namespace Vendor\Project {
    // Code...
}
```

Includes unit tests.
Includes documentation.
Includes metrics.
New sniff to disallow the use of multiple namespaces within a file.

Includes unit tests.
Includes documentation.
Sniff to forbid using import use statements for classes/traits/interfaces.

The sniff contains two error codes `FoundWithoutAlias` and `FoundWithAlias` to allow for only forbidding class `use` import statements with or without alias.

Includes unit tests.
Includes documentation.
Includes metrics.
Sniff to forbid using import use statements for functions.

The sniff contains two error codes `FoundWithoutAlias` and `FoundWithAlias` to allow for only forbidding function `use` import statements with or without alias.

Includes unit tests.
Includes documentation.
Includes metrics.
Sniff to forbid using import use statements for constants.

The sniff contains two error codes `FoundWithoutAlias` and `FoundWithAlias` to allow for only forbidding constant `use` import statements with or without alias.

Includes unit tests.
Includes documentation.
Includes metrics.
New sniff to verify that `else(if)` statements with braces are on a new line.

Sister-sniff to the following two PHPCS native sniffs which each demand that `else[]if` is on the same line as the closing curly of the preceding `(else)if`:
- `PEAR.ControlStructures.ControlSignature[.Found]`
- `Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace`

Other related sniffs:
- `Squiz.ControlStructures.ElseIfDeclaration` Forbids the use of "elseif", demands "else if".
- `PSR2.ControlStructures.ElseIfDeclaration`  Forbids the use of "else if", demands "elseif".

Includes fixer.
Includes unit tests.
Includes documentation.
Includes metrics.
Configurable sniff to enforce/forbid a comma after the last array item.

By default, this sniff will:
- forbid a comma after the last array item for _single-line arrays_.
- enforce a comma after the last array item for _multi-line arrays_.

This can be changed for each type or array individually by setting the `singleLine` or `multiLine` properties in a custom ruleset.
The valid values are: `enforce`, `forbid` or `skip` to not check the comma after the last array item for a particular type of array.

Includes fixers.
Includes unit tests.
Includes documentation.
Includes metrics.
Enforce consistent spacing for the open/close braces of arrays.

The sniff allows for having different settings for:
* Space between the `array` keyword and the open parenthesis for long arrays via the `keywordSpacing` property.
    Accepted values: (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces.
* Spaces on the inside of the braces for empty arrays via the `spacesWhenEmpty` property.
    Accepted values: (string) 'newline', (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces.
* Spaces on the inside of the braces for single-line arrays via the `spacesSingleLine` property;
    Accepted values: (int) number of spaces or `false` to turn this check off. Defaults to `0` spaces.
* Spaces on the inside of the braces for multi-line arrays via the `spacesMultiLine` property.
    Accepted values: (string) 'newline', (int) number of spaces or `false` to turn this check off. Defaults to `newline`.

Note: if any of the above properties are set to `newline`, it is recommended to also include an array indentation sniff.
This sniff will not handle the indentation.

Includes fixers.
Includes unit tests.
Includes documentation.
Includes metrics via the SpacesFixer.
Best practice sniff: detects duplicate array keys in array declarations.

Includes unit tests.
Includes documentation.
Best practice sniff: either have all array items with keys or none. Don't use a mix of keyed and unkeyed array items.

Includes unit tests.
Includes documentation.
Best practice sniff: either have all array items with numeric keys or with string keys. Don't use a mix of integer and numeric  keys for array items.

Includes unit tests.
Includes documentation.
…rce-curly-braces-sniff

New `Universal.Namespaces.EnforceCurlyBraceSyntax` sniff
…llow-curly-braces-sniff

New `Universal.Namespaces.DisallowCurlyBraceSyntax` sniff
…declaration-per-file-sniff

New `Universal.Namespaces.OneDeclarationPerFile` sniff
…isallowuseclass-sniff

New `Universal.UseStatements.DisallowUseClass` sniff
…isallowusefunction-sniff

New `Universal.UseStatements.DisallowUseFunction` sniff
…isallowuseconst-sniff

New `Universal.UseStatements.DisallowUseConst` sniff
…ion-sniff

New `Universal.ControlStructures.IfElseDeclaration` sniff
…erlast-sniff

New `NormalizedArrays.Arrays.CommaAfterLast` sniff
…acespacing-sniff

New `NormalizedArrays.Arrays.ArrayBraceSpacing` sniff
…tearraykey-sniff

New `Universal.Arrays.DuplicateArrayKey` sniff
…yedunkeyed-sniff

New `Universal.Arrays.MixedKeyedUnkeyedArray` sniff
…raykeytypes-sniff

New `Universal.Arrays.MixedArrayKeyTypes` sniff
@jrfnl jrfnl added this to the 1.0 milestone Jan 23, 2020
@jrfnl jrfnl merged commit 8670f18 into master Jan 23, 2020
@jrfnl jrfnl modified the milestones: 1.0, 1.0.0-alpha1 Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant