This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
phpcs-ruleset.xml.dist
103 lines (87 loc) · 4.64 KB
/
phpcs-ruleset.xml.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?xml version="1.0"?>
<!-- PHP_CodeSniffer standard for Joinup. -->
<!-- See http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php -->
<ruleset name="Joinup">
<description>Joinup coding standard</description>
<!-- Include the Slevomat sniffs. -->
<config name="installed_paths" value="../../slevomat/coding-standard"/>
<!-- Exclude unsupported file types. -->
<exclude-pattern>*.gif$</exclude-pattern>
<exclude-pattern>*.png$</exclude-pattern>
<!-- Minified files don't have to comply with coding standards. -->
<exclude-pattern>*.min.css$</exclude-pattern>
<exclude-pattern>*.min.js$</exclude-pattern>
<!-- Exclude frontend third-party libraries from coding standards -->
<exclude-pattern>/web/themes/joinup/vendor/*</exclude-pattern>
<exclude-pattern>/web/themes/joinup/node_modules/*</exclude-pattern>
<rule ref="./vendor/drupal/coder/coder_sniffer/Drupal">
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutStrict" />
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutRelaxed" />
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorVersion" />
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorPeriodAfterSeeUrl" />
<exclude name="Drupal.Semantics.FunctionTriggerError.TriggerErrorSeeUrlFormat" />
<!-- See https://www.drupal.org/project/coder/issues/3228308 -->
<exclude name="Drupal.Classes.UseGlobalClass.RedundantUseStatement" />
</rule>
<rule ref="./vendor/drupal/coder/coder_sniffer/DrupalPractice">
<exclude name="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedVariable" />
<exclude name="DrupalPractice.Yaml" />
</rule>
<rule ref="./vendor/ec-europa/qa-automation/phpcs/QualityAssurance">
<!-- Exclude sniff which incorrectly forces use of alternative method. See https://citnet.tech.ec.europa.eu/CITnet/jira/browse/DQA-1418 -->
<exclude name="QualityAssurance.Functions.DrupalWrappers.FoundWithAlternative" />
<!-- Ignore non-Drupal code. -->
<exclude-pattern>/src/Composer/</exclude-pattern>
</rule>
<!-- Do not report lines exceeding 80 characters for Markdown files that contain long file paths. -->
<rule ref="Drupal.Files.TxtFileLineLength.TooLong">
<exclude-pattern>/web/modules/custom/*/README.md$</exclude-pattern>
</rule>
<!-- Ignore false positives regarding hardcoded paths in README files. -->
<rule ref="QualityAssurance.Generic.HardcodedPath.HardcodedPath">
<exclude-pattern>/README.*</exclude-pattern>
</rule>
<!-- Validate the (post)update identifiers. -->
<rule ref="./src/CodingStandards"/>
<!-- Require the strict types declaration in every PHP file. -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="newlinesCountBetweenOpenTagAndDeclare" value="2"/>
</properties>
</rule>
<!-- Require nullable types to be declared as such. -->
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue">
</rule>
<!-- Forbid annotations which are not included in the Drupal coding standard but are often added by IDEs. -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@author"/>
<element value="@created"/>
<element value="@copyright"/>
<element value="@license"/>
<element value="@package"/>
<element value="@version"/>
</property>
</properties>
</rule>
<!-- Forbid documentation auto-generated by IDEs which does not align with the Drupal documentation standards. -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
<properties>
<property name="forbiddenCommentPatterns" type="array">
<element value="/@inheritDoc/"/>
<element value="/^Class [a-zA-z]*\.$/"/>
<element value="/^Interface [a-zA-z]*\.$/"/>
<element value="/^[a-zA-z]* constructor\.$/"/>
</property>
</properties>
</rule>
<!-- Enforce correct formatting of return types hints. -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<!-- Use statements should be ordered alphabetically. -->
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="caseSensitive" value="true"/>
</properties>
</rule>
</ruleset>