💥 TRENDING: Ticket/ - HD Photos!

Skip to:

Opened 6 weeks ago

Last modified 5 weeks ago

#3658 assigned task (blessed)

PHPCS improvements in 2.7

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Tools - Code Improvements Keywords:
Cc:

Description

Related to #3657, many PHPCS rules have been failing and are now excluded from running, so I'm creating this ticket to track the commits necessary to get them passing and/or included.

See r7352, r7357, r7358, r7359, r7360, r7371, r7372, r7374.

Change History (5)

#1 @johnjamesjacoby
6 weeks ago

In 7375:

Tools - Code Improvement: stop ignoring some MySQL prepare sniffs.

This commit ensures that all SQL is correctly prepared, and that specific queries are tagged to be ignored by PHPCS due to them not using the literal $wpdb global as required by the sniffs.

See #3658.

#2 @johnjamesjacoby
6 weeks ago

In 7376:

Tools - Code Improvement: stop ignoring more PHPCS sniffs.

  • Universal.WhiteSpace.CommaSpacing.TooMuchSpaceAfter
  • WordPress.Arrays.ArrayIndentation.ItemNotAligned
  • WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned
  • WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys
  • WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys
  • WordPress.Arrays.MultipleStatementAlignment.MultilineItemSpaceBeforeDoubleArrow
  • WordPress.Arrays.MultipleStatementAlignment.SpaceBeforeDoubleArrow

This commit includes code formatting changes to pass the above PHPCS checks.

See #3658.

#3 @johnjamesjacoby
6 weeks ago

In 7377:

Tools - Code Improvement: stop ignoring more PHPCS sniffs.

  • WordPress.WP.AlternativeFunctions.rand_mt_rand

This commit prefers wp_rand() over mt_rand() in the Akismet extension.

See #3658.

#4 @johnjamesjacoby
5 weeks ago

In 7378:

Tools - Code Improvement: stop ignoring these PHPCS sniffs:

  • Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
  • Generic.CodeAnalysis.EmptyStatement.DetectedElseif
  • Generic.CodeAnalysis.EmptyStatement.DetectedIf
  • Generic.CodeAnalysis.UselessOverridingMethod.Found
  • Generic.ControlStructures.InlineControlStructure.NotAllowed
  • Generic.Files.LineEndings.InvalidEOLChar
  • Generic.Formatting.DisallowMultipleStatements.SameLine
  • Generic.Formatting.SpaceAfterCast.TooMuchSpace
  • Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace
  • Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
  • NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerMultiLine
  • NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine
  • NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserMultiLine
  • NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine
  • PEAR.Functions.FunctionCallSignature.CloseBracketLine
  • PEAR.Functions.FunctionCallSignature.EmptyLine
  • PEAR.Functions.FunctionCallSignature.Indent
  • PEAR.Functions.FunctionCallSignature.MultipleArguments
  • PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
  • PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess.Found
  • PSR2.Classes.ClassDeclaration.CloseBraceAfterBody
  • PSR2.Classes.PropertyDeclaration.ScopeMissing
  • PSR2.Classes.PropertyDeclaration.Underscore
  • PSR2.Classes.PropertyDeclaration.VarUsed
  • PSR2.ControlStructures.ElseIfDeclaration.NotAllowed
  • PSR2.ControlStructures.SwitchDeclaration.BreakIndent
  • PSR2.Methods.MethodDeclaration.Underscore
  • Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace
  • Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen
  • Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose
  • Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace
  • Squiz.PHP.DisallowSizeFunctionsInLoops.Found
  • Squiz.Scope.MethodScope.Missing
  • Squiz.WhiteSpace.SuperfluousWhitespace.EndLine
  • Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
  • Universal.NamingConventions.NoReservedKeywordParameterNames.echoFound
  • Universal.NamingConventions.NoReservedKeywordParameterNames.parentFound
  • Universal.Operators.DisallowStandalonePostIncrementDecrement.PostDecrementFound
  • Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
  • Universal.Operators.StrictComparisons.LooseEqual
  • Universal.Operators.StrictComparisons.LooseNotEqual
  • WordPress.Arrays.ArrayKeySpacingRestrictions.TooMuchSpaceAfterKey
  • WordPress.DateTime.CurrentTimeTimestamp.Requested
  • WordPress.DateTime.RestrictedFunctions.date_date
  • WordPress.Files.FileName.NotHyphenatedLowercase
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
  • WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
  • WordPress.PHP.IniSet.Risky
  • WordPress.PHP.PregQuoteDelimiter.Missing
  • WordPress.PHP.StrictInArray.MissingTrueStrict
  • WordPress.WP.AlternativeFunctions.parse_url_parse_url
  • WordPress.WP.AlternativeFunctions.rand_mt_rand
  • WordPress.WP.AlternativeFunctions.strip_tags_strip_tag
  • WordPress.WP.AlternativeFunctions.strip_tags_strip_tags
  • WordPress.WP.Capabilities.Unknown
  • WordPress.WP.DeprecatedParameters.Get_termsParam2Found
  • WordPress.WP.DeprecatedParameters.Wp_count_termsParam2Found
  • WordPress.WP.DiscouragedFunctions.query_posts_query_posts
  • WordPress.WP.DiscouragedFunctions.wp_reset_query_wp_reset_query
  • WordPress.WP.EnqueuedResourceParameters.NotInFooter
  • WordPress.WP.GlobalVariablesOverride.Prohibited
  • WordPress.WP.I18n.LowLevelTranslationFunction

This commit includes code formatting changes for the above sniffs.

See #3658.

#5 @johnjamesjacoby
5 weeks ago

In 7379:

Tools - Code Improvement: stop ignoring these PHPCS sniffs:

  • PEAR.Files.IncludingFile.UseRequire
  • PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineDEFAULT
  • PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose
  • Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace
  • Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
  • Squiz.PHP.EmbeddedPhp.MultipleStatements
  • Squiz.PHP.NonExecutableCode.Unreachable
  • Universal.Arrays.DuplicateArrayKey.Found
  • Universal.ControlStructures.DisallowLonelyIf.Found
  • WordPress.PHP.NoSilencedErrors.Discouraged

This commit includes code formatting changes for the above sniffs.

See #3658.

Note: See TracTickets for help on using tickets.