Skip to content

Move WPCS Deprecated VIP Sniffs to VIPCS.#323

Merged
GaryJones merged 2 commits intoAutomattic:masterfrom
rebeccahum:rebecca/move_wpcsvip_sniffs_to_vipcs
Jan 3, 2019
Merged

Move WPCS Deprecated VIP Sniffs to VIPCS.#323
GaryJones merged 2 commits intoAutomattic:masterfrom
rebeccahum:rebecca/move_wpcsvip_sniffs_to_vipcs

Conversation

@rebeccahum
Copy link
Contributor

@rebeccahum rebeccahum commented Dec 28, 2018

This PR:

  • Adds the WPCS deprecated VIP Sniffs (except for SuperGlobalInputUsage because ValidatedSanitizedInput flags the same variables) and their related unit tests to the VIPCS VIP Category:
    • AdminBarRemovalSniff
    • CronIntervalSniff
    • FileSystemWritesDisallowSniff
    • OrderByRandSniff
    • NoPagingSniff (formerly known as PostsPerPage but WPCS has a sniff now for it)
    • RestrictedFunctionsSniff
    • RestrictedVariablesSniff
    • SessionFunctionsUsageSniff
    • SessionVariableUsageSniff
  • Adds to the WordPressVIPMinimum ruleset to reference the WPCS sniffs (as they are no longer categorized in WPCS VIP):
    • WordPress.Security.ValidatedSanitizedInput
    • WordPress.Security.PluginMenuSlug
    • WordPress.WP.PostsPerPage
    • WordPress.WP.TimezoneChange
    • WordPress.DB.DirectDatabaseQuery
    • WordPress.DB.SlowDBQuery
  • Adjusts the WordPress.VIP references in the rulesets to use WordPressVIPMinimum.
  • Removes the silencing of the deprecated WPCS deprecated VIP sniffs.
  • Fixes the PHPDoc comments on existing VIPCS sniffs in the VIP Category.

In short, it fixes #298 and resolves #187 as well.

@rebeccahum rebeccahum requested review from GaryJones and removed request for GaryJones December 28, 2018 05:36
Copy link
Contributor

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like something in the ruleset test needs fixing up as well.

GaryJones
GaryJones previously approved these changes Jan 3, 2019
Rather than the `WordPressVIPMinimum` and `WordPress-VIP-Go` rulesets relying directly on sniffs in `WordPress.VIP` category, the sniffs have been copied over and adapted for VIPCS.

Why?

WPCS had marked the `WordPress.VIP` sniffs as deprecated in WPCS 1.0, and removed them in WPCS 2.0.

VIPCS still has some dependency on WPCS, via classes extended from WPCS abstract sniff classes, and through the referencing of other `WordPress` sniffs in the VIPCS rulesets.

Fixes #187.
`SuperGlobalInputUsageSniff` was not carried over from `WordPress.VIP`, so this section removed.

`FlushRewriteRulesSniff` was removed from `WordPressVIPMinimum`, so testable code now moved to RestrictedFunctions group.

Also clarifies whether lines should cause Errors, Warnings or Messages, instead of just “Bad.”.

See #309. See #187.
@GaryJones
Copy link
Contributor

@rebeccahum

I rebased the PR to take fix the merge conflict due to the removal of FlushRewriteRulesSniff, and I also refreshed the integration test files as overlapping work from #309.

I've expanded on the commit messages as well, to give them more context.

@GaryJones GaryJones merged commit b1f88be into Automattic:master Jan 3, 2019
@GaryJones
Copy link
Contributor

Audit updated.

See commit messages for Change Log info.

@rebeccahum rebeccahum deleted the rebecca/move_wpcsvip_sniffs_to_vipcs branch January 3, 2019 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WPCS 2.0: Remove WordPress.VIP references from rulesets WPCS 2.0: Migrate Deprecated VIP Sniffs

2 participants