Last active
March 1, 2022 15:07
-
-
Save pabamato/398ebabaa95b66733ba32b11f152e12d to your computer and use it in GitHub Desktop.
PHPCS safe to ignore rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="Project Rules"> | |
<rule ref="WordPress" /> | |
<exclude-pattern>/vendor/</exclude-pattern> | |
<exclude-pattern>/dist/</exclude-pattern> | |
<config name="testVersion" value="7.4-"/> | |
<rule ref="WordPress"> | |
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine"/> | |
<exclude name="Generic.Commenting.DocComment.Empty"/> | |
<exclude name="Generic.Commenting.DocComment.MissingShort"/> | |
<exclude name="Generic.Commenting.DocComment.SpacingAfter"/> | |
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags"/> | |
<exclude name="Generic.ControlStructures.InlineControlStructure"/> | |
<exclude name="Generic.Files.OneObjectStructurePerFile.MultipleFound"/> | |
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning"/> | |
<exclude name="Generic.Formatting.SpaceAfterCast.NoSpace"/> | |
<exclude name="Generic.Formatting.SpaceAfterCast.TooMuchSpace"/> | |
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine"/> | |
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.SpaceBeforeBrace"/> | |
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen"/> | |
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose"/> | |
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" /> | |
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/> | |
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.Indent"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.OpeningIndent"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/> | |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket"/> | |
<exclude name="PEAR.NamingConventions.ValidClassName.StartWithCapital"/> | |
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/> | |
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/> | |
<exclude name="Squiz.Commenting.BlockComment.CloserSameLine"/> | |
<exclude name="Squiz.Commenting.BlockComment.NoCapital"/> | |
<exclude name="Squiz.Commenting.BlockComment.NoEmptyLineBefore"/> | |
<exclude name="Squiz.Commenting.ClassComment.Missing"/> | |
<exclude name="Squiz.Commenting.ClassComment.SpacingAfter"/> | |
<exclude name="Squiz.Commenting.DocCommentAlignment.NoSpaceAfterStar"/> | |
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar"/> | |
<exclude name="Squiz.Commenting.FileComment.Missing" /> | |
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/> | |
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/> | |
<exclude name="Squiz.Commenting.FunctionComment.Missing"/> | |
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/> | |
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/> | |
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/> | |
<exclude name="Squiz.Commenting.FunctionComment.WrongStyle"/> | |
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.Missing"/> | |
<exclude name="Squiz.Commenting.InlineComment.NoSpaceBefore"/> | |
<exclude name="Squiz.Commenting.InlineComment.SpacingBefore"/> | |
<exclude name="Squiz.Commenting.VariableComment.Missing"/> | |
<exclude name="Squiz.Commenting.VariableComment.MissingVar"/> | |
<exclude name="Squiz.Commenting.VariableComment.WrongStyle"/> | |
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/> | |
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis"/> | |
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/> | |
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceAfterEquals"/> | |
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpaceBeforeEquals"/> | |
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen"/> | |
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound"/> | |
<exclude name="Squiz.WhiteSpace.SemicolonSpacing.Incorrect"/> | |
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"/> | |
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.SpaceAfterKeyword"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.SpaceInEmptyArray"/> | |
<exclude name="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned"/> | |
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned"/> | |
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys"/> | |
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoSpaceAfterComma"/> | |
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned"/> | |
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/> | |
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/> | |
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/> | |
<exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase"/> | |
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase"/> | |
<exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterCloseParenthesis"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.OpenBraceNotSameLine"/> | |
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter"/> | |
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore"/> | |
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBeforeArrayCloser"/> | |
<exclude name="WordPress.WhiteSpace.PrecisionAlignment.Found"/> | |
<exclude name="WordPress.WhiteSpace.CastStructureSpacing.NoSpaceBeforeOpenParenthesis"/> | |
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeArg"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound"/> | |
<exclude name="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned"/> | |
<exclude name="WordPress.NamingConventions.ValidVariableName.InterpolatedVariableNotSnakeCase"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine"/> | |
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoComma"/> | |
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.CloseBraceNewLine"/> | |
<exclude name="Squiz.WhiteSpace.LanguageConstructSpacing.IncorrectSingle"/> | |
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent"/> | |
<exclude name="WordPress.Arrays.CommaAfterArrayItem.SpaceBeforeComma"/> | |
<exclude name="WordPress.Arrays.CommaAfterArrayItem.CommaAfterLast"/> | |
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/> | |
<exclude name="Generic.Files.EndFileNewline.NotFound"/> | |
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceBeforeOpenParenthesis"/> | |
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys"/> | |
<exclude name="WordPress.WhiteSpace.OperatorSpacing.SpacingBefore"/> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBetweenStructureColon"/> | |
<exclude name="Squiz.Commenting.FileComment.WrongStyle"/> | |
<exclude name="WordPress.WhiteSpace.OperatorSpacing.SpacingAfter"/> | |
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/> | |
<exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBetween"/> | |
<exclude name="WordPress.PHP.StrictComparisons.LooseComparison"/> | |
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/> | |
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/> | |
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" /> | |
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid" /> | |
<exclude name="Generic.PHP.LowerCaseKeyword.Found" /> | |
<exclude name="Generic.Formatting.MultipleStatementAlignment.IncorrectWarning" /> | |
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNotCapital" /> | |
<exclude name="Squiz.Commenting.FunctionComment.MissingParamName" /> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd" /> | |
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma" /> | |
<exclude name="Squiz.Classes.SelfMemberReference.SpaceAfter" /> | |
<exclude name="Squiz.WhiteSpace.ObjectOperatorSpacing.After" /> | |
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma" /> | |
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop" /> | |
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" /> | |
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceBeforeCloseParenthesis" /> | |
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" /> | |
<exclude name="Generic.PHP.LowerCaseConstant.Found" /> | |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd" /> | |
<exclude name="WordPress.WP.EnqueuedResourceParameters.MissingVersion" /> | |
<exclude name="WordPress.WP.EnqueuedResourceParameters.NotInFooter" /> | |
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace" /> | |
<exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed" /> | |
<exclude name="Generic.Commenting.DocComment.ShortNotCapital" /> | |
<exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" /> | |
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" /> | |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" /> | |
<exclude name="Generic.Commenting.DocComment.SpacingAfterTagGroup" /> | |
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" /> | |
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" /> | |
<exclude name="WordPress.Arrays.CommaAfterArrayItem.SpaceAfterComma" /> | |
<exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed" /> | |
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" /> | |
<exclude name="Generic.Strings.UnnecessaryStringConcat.Found" /> | |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeOpenBracket" /> | |
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma" /> | |
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" /> | |
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterCloseBracket" /> | |
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found"/> | |
<exclude name="Squiz.Strings.DoubleQuoteUsage.NotRequired"/> | |
<exclude name="WordPress.PHP.StrictInArray.MissingTrueStrict"/> | |
<exclude name="PEAR.Files.IncludingFile.BracketsNotRequired"/> | |
<exclude name="WordPress.Classes.ClassInstantiation.MissingParenthesis"/> | |
<exclude name="Squiz.PHP.CommentedOutCode.Found"/> | |
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date"/> | |
</rule> | |
<rule ref="Generic.WhiteSpace.ScopeIndent"> | |
<properties> | |
<property name="indent" value="2"/> | |
<property name="tabIndent" value="false"/> | |
</properties> | |
</rule> | |
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reports reference: | |
# https://gist.github.com/pabamato/e2dde7a1645258713e1d0314297b7283 | |
########################################################################################## | |
$ ./vendor/bin/phpcs ./plugins/[plugin-folder]* --standard=".phpcs.xml" --ignore=vendor --extensions=php --report=source > phpcs-report-source.txt | |
Output: | |
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY | |
-------------------------------------------------------------------------------------------------- | |
STANDARD CATEGORY SNIFF COUNT | |
-------------------------------------------------------------------------------------------------- | |
WordPres PHP Strict comparisons loose comparison 677 | |
WordPres PHP Yoda conditions not yoda 672 | |
WordPres Naming conventions Valid variable name variable not snake case 602 | |
WordPres White space Precision alignment found 518 | |
-------------------------------------------------------------------------------------------------- | |
$ ./vendor/bin/phpcs ./plugins/[plugin-folder]* --standard=".phpcs.xml" --ignore=vendor --extensions=php --report=summary > phpcs-report-summary.txt | |
Output: | |
PHP CODE SNIFFER REPORT SUMMARY | |
---------------------------------------- | |
FILE. ERRORS WARNINGS | |
---------------------------------------- | |
file.php 43 5 | |
---------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment