Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,7 @@ jobs:
find . -type f -exec sed -i '/\/\/ phpcs:ignore/ s/, /,/g' {} +
find . -type f -name "*.php" -exec sed -i 's#// @codingStandardsIgnoreStart#// phpcs:disable#g' {} +
find . -type f -name "*.php" -exec sed -i 's#// @codingStandardsIgnoreEnd#// phpcs:enable#g' {} +
sed -i '/<rule ref="Drupal.Functions.FunctionDeclaration"\/>/d' phpcs.xml.dist
sed -i 's/DrupalPractice.CodeAnalysis.VariableAnalysis/VariableAnalysis.CodeAnalysis.VariableAnalysis/g' phpcs.xml.dist
find .. -type f -name "*.php" -exec sed -i 's#// phpcs:ignore DrupalPractice.CodeAnalysis.VariableAnalysis#// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis#g' {} +
../../vendor/bin/phpcs -p -s --parallel=$(nproc) --ignore=lib/Drupal/Core/Command/GenerateTheme.php,modules/mysql/tests/src/Kernel/mysql/Console/DbDumpCommandTest.php
70 changes: 0 additions & 70 deletions coder_sniffer/Drupal/Sniffs/Functions/FunctionDeclarationSniff.php

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions coder_sniffer/Drupal/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
<exclude-pattern>*.tpl.php</exclude-pattern>
</rule>

<!-- Silence deprecated sniffs that will be removed in Coder 9.x. -->
<rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter">
<severity>0</severity>
</rule>
<rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis">
<severity>0</severity>
</rule>

<!-- Silence method name underscore warning which is covered already in
Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps. -->
<rule ref="Drupal.Methods.MethodDeclaration.Underscore">
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions coder_sniffer/DrupalPractice/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<exclude-pattern>*</exclude-pattern>
</rule>

<rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis">
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<!-- Do not run this sniff on template files. -->
<exclude-pattern>*.tpl.php</exclude-pattern>
<properties>
<property name="allowUnusedFunctionParameters" value="true"/>
</properties>
</rule>
<rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedVariable">
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable">
<severity>0</severity>
</rule>

Expand Down
56 changes: 0 additions & 56 deletions tests/DrupalPractice/CodeAnalysis/VariableAnalysisUnitTest.php

This file was deleted.

100 changes: 100 additions & 0 deletions tests/DrupalPractice/bad/BadUnitTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
/**
* Unit test class for all bad files.
*/

namespace DrupalPractice\Test\bad;

use Drupal\Test\CoderSniffUnitTest;

/**
* Unit test class for all bad files.
*/
class BadUnitTest extends CoderSniffUnitTest
{


/**
* Returns the lines where errors should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of errors that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
protected function getErrorList(string $testFile): array
{
return [];

}//end getErrorList()


/**
* Returns the lines where warnings should occur.
*
* The key of the array should represent the line number and the value
* should represent the number of warnings that should occur on that line.
*
* @param string $testFile The name of the file being tested.
*
* @return array<int, int>
*/
protected function getWarningList(string $testFile): array
{
switch ($testFile) {
case 'VariableAnalysisUnitTest.inc':
return [
4 => 1,
8 => 1,
17 => 1,
61 => 1,
];
}

return [];

}//end getWarningList()


/**
* Returns a list of test files that should be checked.
*
* @param string $testFileBase The base path that the unit tests files will have.
*
* @return array<string>
*/
protected function getTestFiles($testFileBase): array
{
$di = new \DirectoryIterator(__DIR__);
$testFiles = [];

foreach ($di as $file) {
$path = $file->getPathname();
if ($path !== __FILE__ && $file->isFile() === true && preg_match('/\.fixed$/', $path) !== 1) {
$testFiles[] = $path;
}
}

// Get them in order.
sort($testFiles);
return $testFiles;

}//end getTestFiles()


/**
* False if just the current sniff should be checked, true if all sniffs should be checked.
*
* @return bool
*/
protected function checkAllSniffCodes()
{
// We want to test all sniffs defined in the standard.
return true;

}//end checkAllSniffCodes()


}//end class