mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-09 23:56:14 +01:00
[FEATURE] Add PHP_CodeSniffer to the Travis CI build (#44)
This commit is contained in:
parent
3cd030387f
commit
023698729b
6 changed files with 140 additions and 3 deletions
|
@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|||
## x.y.z
|
||||
|
||||
### Added
|
||||
- Add PHP_CodeSniffer to the Travis CI build (#44)
|
||||
- Auto-release to the TER (#34)
|
||||
- Composer script for PHP linting
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace OliverKlee\Tea\Tests\Acceptance;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
|
@ -15,12 +15,12 @@
|
|||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
*/
|
||||
class AcceptanceTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\AcceptanceTesterActions;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace Helper;
|
||||
|
||||
// here you can define custom actions
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
"require-dev": {
|
||||
"typo3/cms-fluid-styled-content": "^7.6.23 || ^8.7.10",
|
||||
"helhum/typo3-composer-setup": "^0.5.3",
|
||||
"squizlabs/php_codesniffer": "^3.4.2",
|
||||
"helmich/typo3-typoscript-lint": "^1.4.7",
|
||||
"nimut/testing-framework": "^4.1.3",
|
||||
"codeception/codeception": "^2.5"
|
||||
|
@ -63,6 +64,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"ci:php:lint": "find *.php Classes/ Configuration/ Tests/ -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l",
|
||||
"ci:php:sniff": "phpcs Classes Tests",
|
||||
"ci:ts:lint": "typoscript-lint -c Configuration/TsLint.yml --ansi -n --fail-on-warnings -vvv Configuration/TypoScript/",
|
||||
"ci:tests:unit": "phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/UnitTests.xml Tests/Unit/",
|
||||
"ci:tests:functional": "phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml Tests/Functional/",
|
||||
|
@ -75,6 +77,7 @@
|
|||
],
|
||||
"ci:static": [
|
||||
"@ci:php:lint",
|
||||
"@ci:php:sniff",
|
||||
"@ci:ts:lint"
|
||||
],
|
||||
"ci": [
|
||||
|
|
131
phpcs.xml.dist
Normal file
131
phpcs.xml.dist
Normal file
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="phpList Coding Standard">
|
||||
<description>
|
||||
This standard requires PHP_CodeSniffer >= 3.4.0.
|
||||
</description>
|
||||
|
||||
<arg name="colors"/>
|
||||
<arg name="extensions" value="php"/>
|
||||
|
||||
<!--The complete PSR-2 rule set-->
|
||||
<rule ref="PSR2"/>
|
||||
|
||||
<!--The complete PSR-12 rule set-->
|
||||
<rule ref="PSR12"/>
|
||||
|
||||
<!-- Arrays -->
|
||||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
||||
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
|
||||
|
||||
<!-- Classes -->
|
||||
<rule ref="Generic.Classes.DuplicateClassName"/>
|
||||
<rule ref="PSR1.Classes.ClassDeclaration">
|
||||
<exclude-pattern>Tests/Acceptance/_support/</exclude-pattern>
|
||||
</rule>
|
||||
<rule ref="Squiz.Classes.ClassFileName"/>
|
||||
<rule ref="Squiz.Classes.DuplicateProperty"/>
|
||||
<rule ref="Squiz.Classes.LowercaseClassKeywords"/>
|
||||
<rule ref="Squiz.Classes.SelfMemberReference"/>
|
||||
|
||||
<!-- Code analysis -->
|
||||
<rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
|
||||
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
|
||||
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
|
||||
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
|
||||
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
|
||||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
|
||||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
|
||||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
|
||||
|
||||
<!-- Commenting -->
|
||||
<rule ref="Generic.Commenting.Fixme"/>
|
||||
<rule ref="Generic.Commenting.Todo"/>
|
||||
<rule ref="PEAR.Commenting.InlineComment"/>
|
||||
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
|
||||
<rule ref="Squiz.Commenting.EmptyCatchComment"/>
|
||||
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
|
||||
<rule ref="Squiz.Commenting.PostStatementComment"/>
|
||||
|
||||
<!-- Control structures -->
|
||||
<rule ref="PEAR.ControlStructures.ControlSignature"/>
|
||||
|
||||
<!-- Debug -->
|
||||
<rule ref="Generic.Debug.ClosureLinter"/>
|
||||
|
||||
<!-- Files -->
|
||||
<rule ref="Generic.Files.LineLength">
|
||||
<exclude-pattern>Configuration/TCA/</exclude-pattern>
|
||||
</rule>
|
||||
<rule ref="Generic.Files.OneClassPerFile"/>
|
||||
<rule ref="Generic.Files.OneInterfacePerFile"/>
|
||||
<rule ref="Generic.Files.OneObjectStructurePerFile"/>
|
||||
<rule ref="Zend.Files.ClosingTag"/>
|
||||
|
||||
<!-- Formatting -->
|
||||
<rule ref="PEAR.Formatting.MultiLineAssignment"/>
|
||||
|
||||
<!-- Functions -->
|
||||
<rule ref="Generic.Functions.CallTimePassByReference"/>
|
||||
<rule ref="Squiz.Functions.FunctionDuplicateArgument"/>
|
||||
<rule ref="Squiz.Functions.GlobalFunction"/>
|
||||
|
||||
<!-- Methods -->
|
||||
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
|
||||
<exclude-pattern>Tests/Acceptance/</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<!-- Metrics -->
|
||||
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
|
||||
<rule ref="Generic.Metrics.NestingLevel"/>
|
||||
|
||||
<!-- Naming conventions -->
|
||||
<rule ref="Generic.NamingConventions.ConstructorName"/>
|
||||
<rule ref="PEAR.NamingConventions.ValidClassName"/>
|
||||
|
||||
<!-- Objects -->
|
||||
<rule ref="Squiz.Objects.ObjectMemberComma"/>
|
||||
|
||||
<!-- Operators -->
|
||||
<rule ref="Squiz.Operators.IncrementDecrementUsage"/>
|
||||
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
|
||||
|
||||
<!-- PHP -->
|
||||
<rule ref="Generic.PHP.BacktickOperator"/>
|
||||
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
|
||||
<rule ref="Generic.PHP.DeprecatedFunctions"/>
|
||||
<rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
|
||||
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
||||
<rule ref="Generic.PHP.DiscourageGoto"/>
|
||||
<rule ref="Generic.PHP.ForbiddenFunctions"/>
|
||||
<rule ref="Generic.PHP.NoSilencedErrors"/>
|
||||
<rule ref="Squiz.PHP.CommentedOutCode">
|
||||
<properties>
|
||||
<property name="maxPercentage" value="70"/>
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
|
||||
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
|
||||
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
|
||||
<rule ref="Squiz.PHP.Eval"/>
|
||||
<rule ref="Squiz.PHP.GlobalKeyword"/>
|
||||
<rule ref="Squiz.PHP.Heredoc"/>
|
||||
<rule ref="Squiz.PHP.InnerFunctions"/>
|
||||
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
|
||||
<rule ref="Squiz.PHP.NonExecutableCode"/>
|
||||
|
||||
<!-- Scope -->
|
||||
<rule ref="Squiz.Scope.MemberVarScope"/>
|
||||
<rule ref="Squiz.Scope.StaticThisUsage"/>
|
||||
|
||||
<!--Strings-->
|
||||
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
|
||||
|
||||
<!-- Whitespace -->
|
||||
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
|
||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
|
||||
<rule ref="Squiz.WhiteSpace.CastSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing"/>
|
||||
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
|
||||
</ruleset>
|
Loading…
Reference in a new issue