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

Revert "Pick the PHPCSExtra CommaAfterLastSniff Sniff to moodle" #84

Closed
Closed
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"phpcsstandards/php_codesniffer": "^3.7.2",
"phpcsstandards/phpcsextra": "^1.1.0",
"phpcsstandards/phpcsextra": "^1.2.0",
"phpcompatibility/php-compatibility": "dev-develop#0a17f9ed"
},
"config": {
226 changes: 0 additions & 226 deletions moodle/Sniffs/Arrays/CommaAfterLastSniff.php

This file was deleted.

8 changes: 4 additions & 4 deletions moodle/Tests/NormalizedArraysArraysCommaAfterLastTest.php
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
* @copyright 2023 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* @covers MoodleHQ\MoodleCS\moodle\Sniffs\Arrays\CommaAfterLastSniff
* @covers \PHPCSExtra\NormalizedArrays\Sniffs\Arrays\CommaAfterLastSniff
*/
class NormalizedArraysArraysCommaAfterLastTest extends MoodleCSBaseTestCase
{
@@ -37,16 +37,16 @@ public function testNormalizedArraysArraysCommaAfterLast() {

// Define the standard, sniff and fixture to use.
$this->set_standard('moodle');
$this->set_sniff('moodle.Arrays.CommaAfterLast');
$this->set_sniff('NormalizedArrays.Arrays.CommaAfterLast');
$this->set_fixture(__DIR__ . '/fixtures/normalizedarrays_arrays_commaafterlast.php');

// Define expected results (errors and warnings). Format, array of:
// - line => number of problems, or
// - line => array of contents for message / source problem matching.
// - line => string of contents for message / source problem matching (only 1).
$this->set_errors([
79 => '@Source: moodle.Arrays.CommaAfterLast.FoundSingleLine',
82 => '@Source: moodle.Arrays.CommaAfterLast.MissingMultiLine',
79 => '@Source: NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine',
82 => '@Source: NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine',
87 => 1,
95 => 1,
97 => 1,
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
defined('MOODLE_INTERNAL') || die(); // Make this always the 1st line in all CS fixtures.

// Disabling this error as we do in our ruleset, so tests run the same.
// phpcs:disable moodle.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine
// phpcs:disable NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine

// All these are good / valid code.

Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
defined('MOODLE_INTERNAL') || die(); // Make this always the 1st line in all CS fixtures.

// Disabling this error as we do in our ruleset, so tests run the same.
// phpcs:disable moodle.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine
// phpcs:disable NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine

// All these are good / valid code.

7 changes: 1 addition & 6 deletions moodle/ruleset.xml
Original file line number Diff line number Diff line change
@@ -20,15 +20,10 @@
Affects all major branches since Moodle 3.9.

Require a comma after the last element in a multi-line array, but prevent in a single-line array definition

TODO: Enable this back and remove our copied Sniff below once PHPCSExtra v1.2.0 is released.
-->
<rule ref="NormalizedArrays.Arrays.CommaAfterLast">
<exclude name="NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine" />
</rule>
-->
<rule ref="moodle.Arrays.CommaAfterLast">
<exclude name="moodle.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine" />
</rule>

<rule ref="Generic.Classes.DuplicateClassName"/>
<rule ref="Generic.Classes.OpeningBraceSameLine"/>