Skip to content

Commit 4b37d53

Browse files
committed
Remove "Variable Analysis" too much false positives
1 parent 3b635d9 commit 4b37d53

File tree

6 files changed

+14
-38
lines changed

6 files changed

+14
-38
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Exclude `ArrayAccess` methods from `ReturnTypeDeclarationSniff` and `ArgumentTypeDeclarationSniff`.
66
- Fix bug in `LineLengthSniff` which affected edge cases.
77
- Changed default `LineLengthSniff` max length to 100, excluding leading indent.
8+
- Remove Variable Analysis, too much false positives
89

910
## 0.7.2
1011
- Fix bug in `ReturnTypeDeclarationSniff` which caused wrong return type detection.

Inpsyde/ruleset.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525
<exclude name="Generic.Files.LineLength.TooLong"/>
2626
</rule>
2727

28-
<!--
29-
Some sanity in variables.
30-
See https://github.com/sirbrillig/phpcs-variable-analysis
31-
-->
32-
<rule ref="VariableAnalysis"/>
33-
3428
<!--
3529
Neutron standard are quality tools for PHP7 development from Automattic.
3630
See https://github.com/Automattic/phpcs-neutron-standard

README.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ See http://www.php-fig.org/psr/psr-1/ and http://www.php-fig.org/psr/psr-2/.
9696
The tree of used rules are listed in the `/docs/rules-list/psr.md` file in this repo.
9797

9898

99-
## VariableAnalysis
100-
101-
See https://github.com/sirbrillig/phpcs-variable-analysis
102-
103-
The tree of used rules are listed in the `/docs/rules-list/variable-analysis.md` file in this repo.
104-
105-
10699
## Neutron Standard
107100

108101
See https://github.com/Automattic/phpcs-neutron-standard
@@ -134,18 +127,22 @@ The tree of used rules are listed in the `/docs/rules-list/generic.md` file in t
134127

135128
## Custom Rules
136129

137-
Few custom rules are also in use, highly derived from Object Calisthenics
138-
see (https://github.com/object-calisthenics/phpcs-calisthenics-rules).
139-
130+
Few custom rules are also in use.
140131
Customs rules are:
141132

142-
- Only 2 levels of indentation per Method
143-
- Do not use "else" keyword
133+
- Enforce argument type declaration, with few exception (e.g. hook callbacks or `ArrayAccess` methods)
134+
- Ensure that any assignment inside conditions in wrapped in parenthesis
135+
- Disallow short open PHP tag
144136
- Use minimum 3 chars for names (with a few exclusions)
145-
- No public properties
146-
- No setters
147-
- Max 10 properties per class
148-
- Max 50 lines per method
137+
- No public class properties
138+
- Max 50 lines per function/method, excluding blank lines and comments-only lines.
139+
- Ensure that actions callbacks do not return anything, while filter callbacks return something.
140+
- Max 100 chars per line, excluding leading indent size and long string inWP translation functions
141+
- Discourage usage of getters and setters.
142+
- Discourage usage of `else`.
143+
- Discourage usage of `define` where `const` is preferable.
144+
- Discourage usage of more than 10 properties per class.
145+
- Enforce return type declaration, with few exceptions (e.g. hook callbacks or `ArrayAccess` methods)
149146

150147
The tree of used rules are listed in the `/docs/rules-list/custom.md` file in this repo.
151148

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"dealerdirect/phpcodesniffer-composer-installer": "^0.4",
3232
"wp-coding-standards/wpcs": "^0.14",
3333
"automattic/phpcs-neutron-standard": "^1",
34-
"sirbrillig/phpcs-variable-analysis": "2 - 2.0.5 || >= 2.0.7 < 3",
3534
"wimg/php-compatibility": "^8.0"
3635
},
3736
"require-dev": {

docs/rules-list/variable-analysis.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

phpcs.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@
2929
<exclude name="Generic.Files.LineLength.TooLong"/>
3030
</rule>
3131

32-
<!--
33-
Some sanity in variables.
34-
See https://github.com/sirbrillig/phpcs-variable-analysis
35-
-->
36-
<rule ref="VariableAnalysis"/>
37-
3832
<!--
3933
Neutron standard are quality tools for PHP7 development from Automattic.
4034
See https://github.com/Automattic/phpcs-neutron-standard

0 commit comments

Comments
 (0)