Skip to content

Commit b824065

Browse files
gitlab-ci file and ruleset for phpcs added.
Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
1 parent 824b513 commit b824065

File tree

3 files changed

+156
-1
lines changed

3 files changed

+156
-1
lines changed

.gitlab-ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
variables:
2+
PHP_COMMON_SNIFF_FILE: ruleset.xml
3+
4+
include:
5+
- file: /Auto/php.yml
6+
project: jitesoft/gitlab-ci-lib

example/test.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
use Jitesoft\Container\Container;
44

5-
require_once 'vendor/autoload.php';
5+
require_once '../vendor/autoload.php';
6+
require_once './TestCommand.php';
7+
require_once './TestKernel.php';
68

79
// A custom kernel is created, naming the 'cli application' to 'cli' and settings its description to
810
// 'A test cli.'.

ruleset.xml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="Jitesoft Ruleset V 2.0">
3+
<description>Jitesoft PHPCodeSniffer file.</description>
4+
<arg name="tab-width" value="4"/>
5+
6+
<rule ref="Generic.Arrays.ArrayIndent"/>
7+
<rule ref="Generic.Classes.DuplicateClassName"/>
8+
<rule ref="Generic.Classes.OpeningBraceSameLine" />
9+
<rule ref="Generic.CodeAnalysis.AssignmentInCondition"/>
10+
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
11+
<rule ref="Generic.CodeAnalysis.EmptyPHPStatement"/>
12+
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
13+
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
14+
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
15+
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
16+
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
17+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
18+
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
19+
<rule ref="Generic.Commenting.Todo"/>
20+
<rule ref="Generic.Commenting.Fixme"/>
21+
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
22+
<rule ref="Generic.Files.ByteOrderMark"/>
23+
<rule ref="Generic.Files.LineEndings">
24+
<properties>
25+
<property name="eolChar" value="\n"/>
26+
</properties>
27+
</rule>
28+
<rule ref="Generic.Files.LineLength">
29+
<properties>
30+
<property name="absoluteLineLimit" value="120"/>
31+
<property name="ignoreComments" value="true"/>
32+
</properties>
33+
</rule>
34+
<rule ref="Generic.Files.OneObjectStructurePerFile"/>
35+
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
36+
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
37+
<rule ref="Generic.Formatting.SpaceAfterNot">
38+
<properties>
39+
<property name="spacing" value="0" />
40+
</properties>
41+
</rule>
42+
<rule ref="Generic.Formatting.SpaceAfterCast">
43+
<properties>
44+
<property name="spacing" value="0" />
45+
</properties>
46+
</rule>
47+
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
48+
<properties>
49+
<property name="checkClosures" value="true"/>
50+
<property name="checkFunctions" value="true"/>
51+
</properties>
52+
</rule>
53+
<rule ref="Generic.Metrics.CyclomaticComplexity">
54+
<properties>
55+
<property name="complexity" value="8"/>
56+
<property name="absoluteComplexity" value="10"/>
57+
</properties>
58+
</rule>
59+
<rule ref="Generic.Metrics.NestingLevel"/>
60+
<rule ref="Generic.NamingConventions.ConstructorName"/>
61+
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
62+
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
63+
<rule ref="Generic.PHP.DeprecatedFunctions"/>
64+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
65+
<rule ref="Generic.PHP.LowerCaseType"/>
66+
<rule ref="Generic.PHP.NoSilencedErrors"/>
67+
<rule ref="Generic.PHP.Syntax"/>
68+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
69+
<rule ref="Generic.PHP.LowerCaseKeyword"/>
70+
<rule ref="Generic.PHP.LowerCaseConstant"/>
71+
<rule ref="Generic.PHP.ForbiddenFunctions"/>
72+
<rule ref="Generic.PHP.DiscourageGoto"/>
73+
<rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
74+
<rule ref="Generic.Strings.UnnecessaryStringConcat">
75+
<properties>
76+
<property name="allowMultiline " value="true"/>
77+
</properties>
78+
</rule>
79+
<rule ref="Generic.VersionControl.GitMergeConflict"/>
80+
<rule ref="Generic.WhiteSpace.ArbitraryParenthesesSpacing">
81+
<properties>
82+
<property name="ignoreNewlines" value="true"/>
83+
</properties>
84+
</rule>
85+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
86+
<rule ref="Generic.WhiteSpace.ScopeIndent">
87+
<properties>
88+
<property name="indent" value="4" />
89+
</properties>
90+
</rule>
91+
92+
<rule ref="PEAR.ControlStructures.ControlSignature"/>
93+
<rule ref="PEAR.ControlStructures.MultiLineCondition"/>
94+
<rule ref="PEAR.Files.IncludingFile"/>
95+
<rule ref="PEAR.Formatting.MultiLineAssignment"/>
96+
<rule ref="PEAR.Functions.FunctionCallSignature"/>
97+
<rule ref="PEAR.Functions.ValidDefaultValue"/>
98+
99+
<rule ref="PSR1.Files.SideEffects"/>
100+
<rule ref="PSR1.Methods.CamelCapsMethodName"/>
101+
102+
<rule ref="PSR12.Classes.ClassInstantiation"/>
103+
<rule ref="PSR12.Functions.NullableTypeDeclaration"/>
104+
<rule ref="PSR12.Keywords.ShortFormTypeKeywords"/>
105+
<rule ref="PSR12.Namespaces.CompoundNamespaceDepth"/>
106+
107+
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
108+
<rule ref="PSR2.Classes.PropertyDeclaration"/>
109+
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
110+
<rule ref="PSR2.Files.ClosingTag"/>
111+
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
112+
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
113+
114+
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
115+
<rule ref="Squiz.Commenting.InlineComment"/>
116+
<rule ref="Squiz.Operators.ValidLogicalOperators"/>
117+
<rule ref="Squiz.PHP.CommentedOutCode"/>
118+
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
119+
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
120+
<rule ref="Squiz.PHP.Eval"/>
121+
<rule ref="Squiz.PHP.GlobalKeyword"/>
122+
<rule ref="Squiz.PHP.NonExecutableCode"/>
123+
<rule ref="Squiz.Scope.MemberVarScope"/>
124+
<rule ref="Squiz.Scope.MethodScope"/>
125+
<rule ref="Squiz.Scope.StaticThisUsage"/>
126+
<rule ref="Squiz.Strings.ConcatenationSpacing">
127+
<properties>
128+
<property name="spacing" value="1" />
129+
</properties>
130+
</rule>
131+
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
132+
<rule ref="Squiz.Strings.EchoedStrings"/>
133+
134+
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
135+
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
136+
<properties>
137+
<property name="spacing" value="1" />
138+
<property name="spacingBeforeFirst" value="1" />
139+
<property name="spacingAfterLast" value="1" />
140+
</properties>
141+
</rule>
142+
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
143+
<rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
144+
<rule ref="Squiz.WhiteSpace.PropertyLabelSpacing"/>
145+
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
146+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
147+
</ruleset>

0 commit comments

Comments
 (0)