Skip to content

Commit

Permalink
Merge branch 'trunk' into 464-allow-wp-prefixes-on-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
davidperezgar authored Oct 1, 2024
2 parents 9c107c2 + e8c8b11 commit c476a3f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions docs/creating-a-static-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use WordPress\Plugin_Check\Traits\Stable_Check;
class My_Custom_Check implements Static_Check {

use Stable_Check;

public function get_categories() {
// Return an array of check categories.
// See the `WordPress\Plugin_Check\Checker\Check_Categories` class for available categories.
Expand Down Expand Up @@ -45,7 +45,7 @@ use WordPress\Plugin_Check\Traits\Stable_Check;
* Check for detecting incorrect casing of the word "WordPress" using PHP CodeSniffer.
*/
class My_Custom_Check extends Abstract_PHP_CodeSniffer_Check {

use Stable_Check;

/**
Expand All @@ -64,9 +64,10 @@ class My_Custom_Check extends Abstract_PHP_CodeSniffer_Check {
/**
* Returns an associative array of arguments to pass to PHPCS.
*
* @param Check_Result $result The check result to amend, including the plugin context to check.
* @return array An associative array of PHPCS CLI arguments.
*/
protected function get_args() {
protected function get_args( Check_Result $result ) {
return array(
'extensions' => 'php',
'standard' => 'WordPress',
Expand Down Expand Up @@ -173,8 +174,8 @@ public function run( Check_Result $result ) {

// When an issue is found add a warning.
$result->add_message(
false,
'Warning message content.',
false,
'Warning message content.',
array(
'code' => 'warning_code',
'file' => $plugin_file,
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/Abstract_Check_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ final public function get_checks_to_run() {
/**
* Checks whether the current environment allows for runtime checks to be used.
*
* @since n.e.x.t
* @since 1.2.0
*
* @return bool True if runtime checks are allowed, false otherwise.
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/CLI_Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected function get_slug_param() {
/**
* Checks whether the current environment allows for runtime checks to be used.
*
* @since n.e.x.t
* @since 1.2.0
*
* @return bool True if runtime checks are allowed, false otherwise.
*/
Expand Down
10 changes: 5 additions & 5 deletions includes/Checker/Checks/Plugin_Repo/Offloading_Files_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Check to detect loading files from external sites.
*
* @since n.e.x.t.
* @since 1.2.0.
*/
class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check {

Expand All @@ -26,7 +26,7 @@ class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check {
/**
* Bitwise flags to control check behavior.
*
* @since n.e.x.t.
* @since 1.2.0.
* @var int
*/
protected $flags = 0;
Expand All @@ -36,7 +36,7 @@ class Offloading_Files_Check extends Abstract_PHP_CodeSniffer_Check {
*
* Every check must have at least one category.
*
* @since n.e.x.t.
* @since 1.2.0.
*
* @return array The categories for the check.
*/
Expand Down Expand Up @@ -65,7 +65,7 @@ protected function get_args( Check_Result $result ) {
*
* Every check must have a short description explaining what the check does.
*
* @since n.e.x.t.
* @since 1.2.0.
*
* @return string Description.
*/
Expand All @@ -78,7 +78,7 @@ public function get_description(): string {
*
* Every check must have a URL with further information about the check.
*
* @since n.e.x.t.
* @since 1.2.0.
*
* @return string The documentation URL.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ private function check_for_contributors( Check_Result $result, string $readme_fi
$valid = true;

foreach ( $usernames as $username ) {
if ( 1 !== preg_match( '/^[a-z0-9\s_.\-@]+$/', $username ) ) {
if ( 1 !== preg_match( '/^[a-z0-9_.\-@ ]+$/i', $username ) ) {
$valid = false;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Checker/Checks/Plugin_Repo/Trademarks_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ private function has_trademarked_slug( $slug ) {
$has_trademarked_slug = false;

foreach ( self::TRADEMARK_SLUGS as $trademark ) {
if ( '-' === $trademark[-1] ) {
if ( str_ends_with( $trademark, '-' ) ) {
// Trademarks ending in "-" indicate slug cannot begin with that term.
if ( 0 === strpos( $slug, $trademark ) ) {
$has_trademarked_slug = $trademark;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Class for an exception thrown when an invalid check slug is provided.
*
* @since n.e.x.t
* @since 1.2.0
*/
class Invalid_Check_Slug_Exception extends InvalidArgumentException {

Expand Down

0 comments on commit c476a3f

Please sign in to comment.