felixarntz/wp-plugin-contracts

View on GitHub

Showing 5 of 5 total issues

Avoid excessively long variable names like $network_active_plugins. Keep variable name length under 20.
Open

        $network_active_plugins = wp_get_active_network_plugins();
Severity: Minor
Found in src/Plugin_Trait.php by phpmd

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Method load_plugin_instance has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function load_plugin_instance( string $main_file, string $class_name ) : Plugin {
        if ( ! class_exists( $class_name ) ) {
            throw new Plugin_Loading_Exception(
                sprintf(
                    'Plugin class %s does not exist.',
Severity: Minor
Found in src/Plugin_Container.php - About 1 hr to fix

    The method install has a boolean flag argument $network_wide, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function install( bool $network_wide = false );
    Severity: Minor
    Found in src/Installable.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method deactivate has a boolean flag argument $network_wide, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function deactivate( bool $network_wide = false );
    Severity: Minor
    Found in src/Deactivatable.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    The method activate has a boolean flag argument $network_wide, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function activate( bool $network_wide = false );
    Severity: Minor
    Found in src/Activatable.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Severity
    Category
    Status
    Source
    Language