Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Sniffer additions #397

Open
dereuromark opened this issue Aug 23, 2024 · 3 comments
Open

Enhancement: Sniffer additions #397

dereuromark opened this issue Aug 23, 2024 · 3 comments

Comments

@dereuromark
Copy link
Member

I recommend adding/porting a few snippets from the current leading collection of sane sniffs^^

as well as a few other useful ones.

@markstory
Copy link
Member

Removing function aliases seems like a good addition.

@dereuromark
Copy link
Member Author

Also

  • SlevomatCodingStandard.Functions.RequireTrailingCommaInCall

Refs cakephp/cakephp#18032

@dereuromark
Copy link
Member Author

So specifically the FunctionAlias sniff would be useful to port.

I made a small diff of the changes compared to PHPCollective code sniffer to see if any useful ones might be missing still.
Specifically the SlevomatCodingStandard ones are easy to pull in!

-# CakePHP ruleset
+# PhpCollective Code Sniffer
 
-The CakePHP standard contains 153 sniffs
 
-CakePHP (20 sniffs)
--------------------
-- CakePHP.Classes.ReturnTypeHint
-- CakePHP.Commenting.DocBlockAlignment
-- CakePHP.Commenting.FunctionComment
-- CakePHP.Commenting.InheritDoc
-- CakePHP.Commenting.TypeHint
-- CakePHP.ControlStructures.ControlStructures
-- CakePHP.ControlStructures.ElseIfDeclaration
-- CakePHP.ControlStructures.WhileStructures
-- CakePHP.Formatting.BlankLineBeforeReturn
-- CakePHP.Functions.ClosureDeclaration
-- CakePHP.NamingConventions.ValidFunctionName
-- CakePHP.NamingConventions.ValidTraitName
-- CakePHP.PHP.DisallowShortOpenTag
-- CakePHP.PHP.SingleQuote
-- CakePHP.WhiteSpace.EmptyLines
-- CakePHP.WhiteSpace.FunctionCallSpacing
-- CakePHP.WhiteSpace.FunctionClosingBraceSpace
-- CakePHP.WhiteSpace.FunctionOpeningBraceSpace
-- CakePHP.WhiteSpace.FunctionSpacing
-- CakePHP.WhiteSpace.TabAndSpace
+The PhpCollectiveStrict standard contains 217 sniffs
+
+PhpCollective (80 sniffs)
+-------------------------
+- PhpCollective.Arrays.DisallowImplicitArrayCreation
+- PhpCollective.Classes.ClassFileName
+- PhpCollective.Classes.EnumCaseCasing
+- PhpCollective.Classes.MethodArgumentDefaultValue
+- PhpCollective.Classes.MethodDeclaration
+- PhpCollective.Classes.MethodTypeHint
+- PhpCollective.Classes.PropertyDefaultValue
+- PhpCollective.Classes.Psr4
+- PhpCollective.Classes.ReturnTypeHint
+- PhpCollective.Classes.SelfAccessor
+- PhpCollective.Commenting.Attributes
+- PhpCollective.Commenting.DisallowArrayTypeHintSyntax
+- PhpCollective.Commenting.DisallowShorthandNullableTypeHint
+- PhpCollective.Commenting.DocBlock
+- PhpCollective.Commenting.DocBlockConst
+- PhpCollective.Commenting.DocBlockConstructor
+- PhpCollective.Commenting.DocBlockNoEmpty
+- PhpCollective.Commenting.DocBlockNoInlineAlignment
+- PhpCollective.Commenting.DocBlockParam
+- PhpCollective.Commenting.DocBlockParamAllowDefaultValue
+- PhpCollective.Commenting.DocBlockParamArray
+- PhpCollective.Commenting.DocBlockParamNotJustNull
+- PhpCollective.Commenting.DocBlockPipeSpacing
+- PhpCollective.Commenting.DocBlockReturnNull
+- PhpCollective.Commenting.DocBlockReturnNullableType
+- PhpCollective.Commenting.DocBlockReturnSelf
+- PhpCollective.Commenting.DocBlockReturnTag
+- PhpCollective.Commenting.DocBlockReturnVoid
+- PhpCollective.Commenting.DocBlockStructure
+- PhpCollective.Commenting.DocBlockTag
+- PhpCollective.Commenting.DocBlockTagGrouping
+- PhpCollective.Commenting.DocBlockTagIterable
+- PhpCollective.Commenting.DocBlockTagOrder
+- PhpCollective.Commenting.DocBlockThrows
+- PhpCollective.Commenting.DocBlockTypeOrder
+- PhpCollective.Commenting.DocBlockVar
+- PhpCollective.Commenting.DocBlockVarNotJustNull
+- PhpCollective.Commenting.DocComment
+- PhpCollective.Commenting.FileDocBlock
+- PhpCollective.Commenting.FullyQualifiedClassNameInDocBlock
+- PhpCollective.Commenting.InlineDocBlock
+- PhpCollective.Commenting.TypeHint
+- PhpCollective.ControlStructures.ConditionalExpressionOrder
+- PhpCollective.ControlStructures.ControlStructureSpacing
+- PhpCollective.ControlStructures.DisallowAlternativeControlStructures
+- PhpCollective.ControlStructures.DisallowCloakingCheck
+- PhpCollective.ControlStructures.ElseIfDeclaration
+- PhpCollective.ControlStructures.NoInlineAssignment
+- PhpCollective.Formatting.ArrayDeclaration
+- PhpCollective.Formatting.MethodSignatureParametersLineBreakMethod
+- PhpCollective.Internal.DisallowFunctions
+- PhpCollective.Namespaces.FunctionNamespace
+- PhpCollective.Namespaces.UseStatement
+- PhpCollective.Namespaces.UseWithAliasing
+- PhpCollective.PHP.DeclareStrictTypes
+- PhpCollective.PHP.DisallowFunctions
+- PhpCollective.PHP.DisallowTrailingCommaInSingleLine
+- PhpCollective.PHP.Exit
+- PhpCollective.PHP.NoIsNull
+- PhpCollective.PHP.NotEqual
+- PhpCollective.PHP.PhpSapiConstant
+- PhpCollective.PHP.PreferCastOverFunction
+- PhpCollective.PHP.RemoveFunctionAlias
+- PhpCollective.PHP.ShortCast
+- PhpCollective.PHP.SingleQuote
+- PhpCollective.Testing.AssertPrimitives
+- PhpCollective.Testing.ExpectException
+- PhpCollective.Testing.Mock
+- PhpCollective.WhiteSpace.CommaSpacing
+- PhpCollective.WhiteSpace.ConcatenationSpacing
+- PhpCollective.WhiteSpace.DocBlockSpacing
+- PhpCollective.WhiteSpace.EmptyEnclosingLine
+- PhpCollective.WhiteSpace.EmptyLines
+- PhpCollective.WhiteSpace.FunctionSpacing
+- PhpCollective.WhiteSpace.ImplicitCastSpacing
+- PhpCollective.WhiteSpace.MemberVarSpacing
+- PhpCollective.WhiteSpace.MethodSpacing
+- PhpCollective.WhiteSpace.NamespaceSpacing
+- PhpCollective.WhiteSpace.ObjectAttributeSpacing
+- PhpCollective.WhiteSpace.TernarySpacing
 
 Generic (25 sniffs)
 -------------------
@@ -53,9 +114,12 @@
 - Generic.WhiteSpace.IncrementDecrementSpacing
 - Generic.WhiteSpace.ScopeIndent
 
-PEAR (1 sniff)
---------------
+PEAR (4 sniffs)
+---------------
+- PEAR.Classes.ClassDeclaration
+- PEAR.ControlStructures.ControlSignature
 - PEAR.Functions.ValidDefaultValue
+- PEAR.NamingConventions.ValidClassName
 
 PSR1 (3 sniffs)
 ---------------
@@ -63,10 +127,11 @@
 - PSR1.Files.SideEffects
 - PSR1.Methods.CamelCapsMethodName
 
-PSR2 (9 sniffs)
----------------
+PSR2 (12 sniffs)
+----------------
 - PSR2.Classes.ClassDeclaration
 - PSR2.Classes.PropertyDeclaration
+- PSR2.ControlStructures.ControlStructureSpacing
 - PSR2.ControlStructures.ElseIfDeclaration
 - PSR2.ControlStructures.SwitchDeclaration
 - PSR2.Files.ClosingTag
@@ -74,8 +139,10 @@
 - PSR2.Methods.FunctionCallSignature
 - PSR2.Methods.FunctionClosingBrace
 - PSR2.Methods.MethodDeclaration
+- PSR2.Namespaces.NamespaceDeclaration
+- PSR2.Namespaces.UseDeclaration
 
-PSR12 (17 sniffs)
+PSR12 (14 sniffs)
 -----------------
 - PSR12.Classes.AnonClassDeclaration
 - PSR12.Classes.ClassInstantiation
@@ -83,10 +150,7 @@
 - PSR12.Classes.OpeningBraceSpace
 - PSR12.ControlStructures.BooleanOperatorPlacement
 - PSR12.ControlStructures.ControlStructureSpacing
-- PSR12.Files.DeclareStatement
-- PSR12.Files.FileHeader
 - PSR12.Files.ImportStatement
-- PSR12.Files.OpenTag
 - PSR12.Functions.NullableTypeDeclaration
 - PSR12.Functions.ReturnTypeDeclaration
 - PSR12.Keywords.ShortFormTypeKeywords
@@ -95,62 +159,60 @@
 - PSR12.Properties.ConstantVisibility
 - PSR12.Traits.UseDeclaration
 
-SlevomatCodingStandard (49 sniffs)
+SlevomatCodingStandard (48 sniffs)
 ----------------------------------
+- SlevomatCodingStandard.Arrays.ArrayAccess
+- SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement
+- SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace
 - SlevomatCodingStandard.Arrays.TrailingArrayComma
-- SlevomatCodingStandard.Attributes.AttributeAndTargetSpacing
-- SlevomatCodingStandard.Attributes.RequireAttributeAfterDocComment
+- SlevomatCodingStandard.Classes.BackedEnumTypeSpacing
 - SlevomatCodingStandard.Classes.ClassConstantVisibility
-- SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces
+- SlevomatCodingStandard.Classes.ClassMemberSpacing
+- SlevomatCodingStandard.Classes.ConstantSpacing
+- SlevomatCodingStandard.Classes.EnumCaseSpacing
 - SlevomatCodingStandard.Classes.ModernClassNameReference
-- SlevomatCodingStandard.Classes.PropertyDeclaration
+- SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration
 - SlevomatCodingStandard.Commenting.DisallowOneLinePropertyDocComment
-- SlevomatCodingStandard.Commenting.DocCommentSpacing
 - SlevomatCodingStandard.Commenting.EmptyComment
 - SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration
 - SlevomatCodingStandard.ControlStructures.AssignmentInCondition
 - SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch
 - SlevomatCodingStandard.ControlStructures.DisallowYodaComparison
-- SlevomatCodingStandard.ControlStructures.LanguageConstructWithParentheses
+- SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing
 - SlevomatCodingStandard.ControlStructures.NewWithParentheses
 - SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator
+- SlevomatCodingStandard.ControlStructures.RequireShortTernaryOperator
 - SlevomatCodingStandard.Exceptions.DeadCatch
 - SlevomatCodingStandard.Functions.ArrowFunctionDeclaration
-- SlevomatCodingStandard.Functions.DisallowTrailingCommaInCall
-- SlevomatCodingStandard.Functions.DisallowTrailingCommaInClosureUse
-- SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration
 - SlevomatCodingStandard.Functions.NamedArgumentSpacing
 - SlevomatCodingStandard.Functions.RequireTrailingCommaInCall
 - SlevomatCodingStandard.Functions.RequireTrailingCommaInClosureUse
-- SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration
 - SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses
 - SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation
 - SlevomatCodingStandard.Namespaces.NamespaceDeclaration
 - SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
+- SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile
 - SlevomatCodingStandard.Namespaces.UnusedUses
 - SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash
 - SlevomatCodingStandard.Namespaces.UseFromSameNamespace
+- SlevomatCodingStandard.Namespaces.UselessAlias
 - SlevomatCodingStandard.Namespaces.UseSpacing
+- SlevomatCodingStandard.Operators.SpreadOperatorSpacing
+- SlevomatCodingStandard.PHP.ForbiddenClasses
 - SlevomatCodingStandard.PHP.ShortList
 - SlevomatCodingStandard.PHP.TypeCast
-- SlevomatCodingStandard.PHP.UselessParentheses
 - SlevomatCodingStandard.PHP.UselessSemicolon
-- SlevomatCodingStandard.TypeHints.DeclareStrictTypes
 - SlevomatCodingStandard.TypeHints.LongTypeHints
 - SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue
-- SlevomatCodingStandard.TypeHints.ParameterTypeHint
 - SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing
-- SlevomatCodingStandard.TypeHints.PropertyTypeHint
-- SlevomatCodingStandard.TypeHints.ReturnTypeHint
 - SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing
 - SlevomatCodingStandard.TypeHints.UnionTypeHintFormat
 - SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable
-- SlevomatCodingStandard.Variables.UnusedVariable
+- SlevomatCodingStandard.Whitespaces.DuplicateSpaces
 
-Squiz (28 sniffs)
+Squiz (27 sniffs)
 -----------------
 - Squiz.Arrays.ArrayBracketSpacing
-- Squiz.Classes.ClassFileName
 - Squiz.Classes.LowercaseClassKeywords
 - Squiz.Classes.ValidClassName
 - Squiz.Commenting.DocCommentAlignment
@@ -163,7 +225,6 @@
 - Squiz.Functions.LowercaseFunctionKeywords
 - Squiz.Functions.MultiLineFunctionDeclaration
 - Squiz.Operators.ValidLogicalOperators
-- Squiz.PHP.DisallowSizeFunctionsInLoops
 - Squiz.PHP.Eval
 - Squiz.PHP.NonExecutableCode
 - Squiz.Scope.MemberVarScope
@@ -171,6 +232,7 @@
 - Squiz.Scope.StaticThisUsage
 - Squiz.WhiteSpace.CastSpacing
 - Squiz.WhiteSpace.ControlStructureSpacing
+- Squiz.WhiteSpace.FunctionOpeningBraceSpace
 - Squiz.WhiteSpace.LanguageConstructSpacing
 - Squiz.WhiteSpace.LogicalOperatorSpacing
 - Squiz.WhiteSpace.ScopeClosingBrace
@@ -180,4 +242,4 @@
 
 Zend (1 sniff)
 --------------
-- Zend.NamingConventions.ValidVariableName
\ No newline at end of file
+- Zend.Files.ClosingTag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants