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

OPENEUROPA-1535: Revert. #69

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ List of conventions for OpenEuropa projects and components.

## PHP Code Sniffer

- For generic PHP projects: [PSR-2 coding standards](https://www.php-fig.org/psr/psr-2)
with the following additions:
- Comments, array declarations and code that is split over multiple lines also
need to be indented with 4 characters.
- For generic PHP projects: [PSR-2 coding standards](https://www.php-fig.org/psr/psr-2).
- For Drupal projects: [Drupal coding standards](https://www.drupal.org/docs/develop/standards)

## PHP Mess Detector
Expand Down
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,3 @@ git config --global --unset core.hooksPath
* Best results were gained using the [Docker app](https://docs.docker.com/docker-for-mac/install/)
* The local repo folder should be shared under Docker -> Preferences -> File sharing to enable the file to be written locally.

## Patches

The component uses the PSR-2 standard based on version 3.4 of package [squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
As the PSR-2 standard does not enforce indentation, we decided to add custom rules in a custom ruleset in order to make sure
that our code is properly indented.
Unfortunately, there are some issues in versions 3.4 of [squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) regarding
code indentation and we fixed them by including custom patches.
Those issues are partially solved in version 3.5 which is not stable yet.
As soon as 3.5 reaches a stable version, we will remove those patches.
14 changes: 2 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"cweagans/composer-patches": "^1.0",
"drupal/coder": "^8.3",
"phpmd/phpmd" : "^2.6",
"phpro/grumphp": "^0.14.2",
"squizlabs/php_codesniffer": "^3.4.0"
"phpro/grumphp": "^0.14.2"
},
"require-dev": {
"phpunit/phpunit": "^5.5|^6.0"
Expand All @@ -22,17 +21,8 @@
"OpenEuropa\\CodeReview\\Tests\\": "./tests/"
}
},
"extra": {
"enable-patching": true,
"composer-exit-on-patch-failure": 1,
"patches": {
"squizlabs/php_codesniffer": {
"Fix conflict between scope indentation and array indentation checking. Ref. https://github.com/squizlabs/PHP_CodeSniffer/issues/2281": "https://gist.githubusercontent.com/drupol/c307b48fe4eb187b0833afb1d1b97e6a/raw/c3d414e9f4c182387ca9405c36f5daeb7b51ae05/phpcs-390bffe2265aac8184fdf86400c0d0841e65bc4b.patch",
"Disable exact checking of multi-line chained method calls in Generic.WhiteSpace.ScopeIndent. Ref. https://github.com/squizlabs/PHP_CodeSniffer/pull/2372": "https://gist.githubusercontent.com/drupol/c307b48fe4eb187b0833afb1d1b97e6a/raw/c3d414e9f4c182387ca9405c36f5daeb7b51ae05/phpcs-pr-2372.patch"
}
}
},
"scripts": {
"changelog": "docker run --rm -v \"$(pwd):$(pwd)\" -w $(pwd) muccg/github-changelog-generator openeuropa/code-review -t $CHANGELOG_GITHUB_TOKEN --future-release=$CHANGELOG_FUTURE_RELEASE"
}
}

2 changes: 1 addition & 1 deletion dist/library-conventions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ imports:
- { resource: base-conventions.yml }

parameters:
tasks.phpcs.standard: ./vendor/openeuropa/code-review/resources/library-phpcs-ruleset.xml
tasks.phpcs.standard: ./vendor/squizlabs/php_codesniffer/src/Standards/PSR2
tasks.phpcs.warning_severity: 0
1 change: 0 additions & 1 deletion grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ parameters:
- tests/fixtures/
tasks.phpmd.ruleset:
- ./resources/phpmd-ruleset.xml
tasks.phpcs.standard: ./resources/library-phpcs-ruleset.xml
22 changes: 0 additions & 22 deletions resources/library-phpcs-ruleset.xml

This file was deleted.

6 changes: 2 additions & 4 deletions tests/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ public function getFixture($fixture)
*/
protected function getContainer($configuration)
{
// Create a GrumPHP configuration file to use in the test. Check if a configuration specific file exists, or
// fall back to a generic template file.
$filename = file_exists(__DIR__."/$configuration.yml.dist") ? __DIR__."/$configuration.yml.dist" : __DIR__.'/grumphp.yml.dist';
$content = file_get_contents($filename);
// Prepare test GrumPHP configuration file.
$content = file_get_contents(__DIR__."/grumphp.yml.dist");
$content = str_replace("{configuration}", $configuration, $content);
file_put_contents(__DIR__."/grumphp.yml", $content);

Expand Down
8 changes: 4 additions & 4 deletions tests/DrupalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public function testPhpMessDetector($fixture, $expected)
public function commitMessageProvider()
{
return [
['phpmd/correct-code.inc', TaskResult::PASSED],
['phpmd/correct-code.module', TaskResult::PASSED],
['phpmd/correct-code.theme', TaskResult::PASSED],
['phpmd/ignored-code.xxx', TaskResult::SKIPPED],
['phpmd/correct-code.inc', TaskResult::PASSED],
['phpmd/correct-code.module', TaskResult::PASSED],
['phpmd/correct-code.theme', TaskResult::PASSED],
['phpmd/ignored-code.xxx', TaskResult::SKIPPED],
];
}
}
8 changes: 4 additions & 4 deletions tests/GitCommitMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ public function testCommitMessage($message, $expected)
public function commitMessageProvider()
{
return [
['Issue #3: Nice GitHub commit message.', TaskResult::PASSED],
['#3: Not nice GitHub commit message.', TaskResult::FAILED],
['NEPT-123: Nice Jira commit message.', TaskResult::PASSED],
['Failed message', TaskResult::FAILED],
['Issue #3: Nice GitHub commit message.', TaskResult::PASSED],
['#3: Not nice GitHub commit message.', TaskResult::FAILED],
['NEPT-123: Nice Jira commit message.', TaskResult::PASSED],
['Failed message', TaskResult::FAILED],
];
}
}
70 changes: 0 additions & 70 deletions tests/PhpCodeSnifferTest.php

This file was deleted.

72 changes: 0 additions & 72 deletions tests/PhpCodeSnifferTestBase.php

This file was deleted.

4 changes: 2 additions & 2 deletions tests/PhpMessDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function testPhpCodeMessage($fixture, $expected)
public function commitMessageProvider()
{
return [
['phpmd/correct-code.php', TaskResult::PASSED],
['phpmd/incorrect-code.php', TaskResult::FAILED],
['phpmd/correct-code.php', TaskResult::PASSED],
['phpmd/incorrect-code.php', TaskResult::FAILED],
];
}
}
29 changes: 0 additions & 29 deletions tests/fixtures/phpcs/correct-library-code.php

This file was deleted.

34 changes: 0 additions & 34 deletions tests/fixtures/phpcs/incorrect-library-code.php

This file was deleted.

7 changes: 0 additions & 7 deletions tests/library-conventions.yml.dist

This file was deleted.