PluginProbe
Plugin Check (PCP) / 1.5.0
Plugin Check (PCP) v1.5.0
2.1.0 trunk 0.1 0.2.0 0.2.1 0.2.2 0.2.3 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.3.0 1.3.1 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 ci-artifacts
plugin-check / includes / Checker / Checks / Plugin_Repo / Plugin_Review_PHPCS_Check.php

Plugin_Review_PHPCS_Check.php in Plugin Check (PCP) 1.5.0, at includes/Checker/Checks/Plugin_Repo/Plugin_Review_PHPCS_Check.php

78 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Plugin_Review_PHPCS_Check.
4 *
5 * @package plugin-check
6 */
7
8 namespace WordPress\Plugin_Check\Checker\Checks\Plugin_Repo;
9
10 use WordPress\Plugin_Check\Checker\Check_Categories;
11 use WordPress\Plugin_Check\Checker\Check_Result;
12 use WordPress\Plugin_Check\Checker\Checks\Abstract_PHP_CodeSniffer_Check;
13 use WordPress\Plugin_Check\Traits\Stable_Check;
14
15 /**
16 * Check for running WordPress plugin review PHPCS standard.
17 *
18 * @since 1.0.0
19 */
20 class Plugin_Review_PHPCS_Check extends Abstract_PHP_CodeSniffer_Check {
21
22 use Stable_Check;
23
24 /**
25 * Gets the categories for the check.
26 *
27 * Every check must have at least one category.
28 *
29 * @since 1.0.0
30 *
31 * @return array The categories for the check.
32 */
33 public function get_categories() {
34 return array( Check_Categories::CATEGORY_PLUGIN_REPO );
35 }
36
37 /**
38 * Returns an associative array of arguments to pass to PHPCS.
39 *
40 * @since 1.0.0
41 *
42 * @param Check_Result $result The check result to amend, including the plugin context to check.
43 * @return array An associative array of PHPCS CLI arguments.
44 */
45 protected function get_args( Check_Result $result ) {
46 return array(
47 'extensions' => 'php',
48 'standard' => WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'phpcs-rulesets/plugin-review.xml',
49 );
50 }
51
52 /**
53 * Gets the description for the check.
54 *
55 * Every check must have a short description explaining what the check does.
56 *
57 * @since 1.1.0
58 *
59 * @return string Description.
60 */
61 public function get_description(): string {
62 return __( 'Runs PHP_CodeSniffer to detect certain best practices plugins should follow for submission on WordPress.org.', 'plugin-check' );
63 }
64
65 /**
66 * Gets the documentation URL for the check.
67 *
68 * Every check must have a URL with further information about the check.
69 *
70 * @since 1.1.0
71 *
72 * @return string The documentation URL.
73 */
74 public function get_documentation_url(): string {
75 return __( 'https://developer.wordpress.org/plugins/plugin-basics/best-practices/', 'plugin-check' );
76 }
77 }
78