wp-bootstrap/wp-bootstrap-gallery

View on GitHub

Showing 178 of 178 total issues

Method wp_bootstrap_gallery has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wp_bootstrap_gallery( $content, $attr ) {
    global $instance, $post;
    $instance++;

    if ( isset( $attr['orderby'] ) ) {
Severity: Major
Found in wp-bootstrap-gallery.php - About 4 hrs to fix

    Function wp_bootstrap_gallery has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_bootstrap_gallery( $content, $attr ) {
        global $instance, $post;
        $instance++;
    
        if ( isset( $attr['orderby'] ) ) {
    Severity: Minor
    Found in wp-bootstrap-gallery.php - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid using undefined variables such as '$order' which will lead to PHP notices.
    Open

                'order'                => $order,
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$order' which will lead to PHP notices.
    Open

                'order'                => $order,
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$order' which will lead to PHP notices.
    Open

        if ( 'RAND' === $order ) {
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$order' which will lead to PHP notices.
    Open

                'order'                => $order,
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$size' which will lead to PHP notices.
    Open

                $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n";
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$size' which will lead to PHP notices.
    Open

        $size_class    = sanitize_html_class( $size );
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid variables with short names like $id. Configured minimum length is 3.
    Open

        $id = intval( $id );
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    Array double arrow not aligned correctly; expected 7 space(s) between "'size'" and double arrow, but found 10.
    Open

            'size'            => 'thumbnail',
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

                'post_parent'        => $id,
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

        $float        = (is_rtl()) ? 'right' : 'left';
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

        $selector    = "gallery-{$instance}";
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

        $size_class    = sanitize_html_class( $size );
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

            'include'        => '',
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Array double arrow not aligned correctly; expected 6 space(s) between "'post_type'" and double arrow, but found 9.
    Open

                'post_type'            => 'attachment',
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Array double arrow not aligned correctly; expected 1 space(s) between "'post_mime_type'" and double arrow, but found 4.
    Open

                'post_mime_type'    => 'image',
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

                'order'                => $order,
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Spaces must be used for mid-line alignment; tabs are not allowed
    Open

        $output        = "<div class='row' id='$selector'>";
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer

    Tabs must be used to indent lines; spaces are not allowed
    Open

                break;
    Severity: Minor
    Found in wp-bootstrap-gallery.php by phpcodesniffer
    Severity
    Category
    Status
    Source
    Language