Showing 178 of 178 total issues
Method wp_bootstrap_gallery
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function wp_bootstrap_gallery( $content, $attr ) {
global $instance, $post;
$instance++;
if ( isset( $attr['orderby'] ) ) {
Function wp_bootstrap_gallery
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Open
function wp_bootstrap_gallery( $content, $attr ) {
global $instance, $post;
$instance++;
if ( isset( $attr['orderby'] ) ) {
- Read upRead up
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
Open
'order' => $order,
- Read upRead up
- Exclude checks
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
Open
'order' => $order,
- Read upRead up
- Exclude checks
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
Open
if ( 'RAND' === $order ) {
- Read upRead up
- Exclude checks
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
Open
'order' => $order,
- Read upRead up
- Exclude checks
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
Open
$output .= wp_get_attachment_link( $att_id, $size, true ) . "\n";
- Read upRead up
- Exclude checks
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
Open
$size_class = sanitize_html_class( $size );
- Read upRead up
- Exclude checks
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
Open
$id = intval( $id );
- Read upRead up
- Exclude checks
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
Open
'size' => 'thumbnail',
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
'post_parent' => $id,
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
$float = (is_rtl()) ? 'right' : 'left';
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
$selector = "gallery-{$instance}";
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
$size_class = sanitize_html_class( $size );
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
'include' => '',
- Exclude checks
Array double arrow not aligned correctly; expected 6 space(s) between "'post_type'" and double arrow, but found 9. Open
Open
'post_type' => 'attachment',
- Exclude checks
Array double arrow not aligned correctly; expected 1 space(s) between "'post_mime_type'" and double arrow, but found 4. Open
Open
'post_mime_type' => 'image',
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
'order' => $order,
- Exclude checks
Spaces must be used for mid-line alignment; tabs are not allowed Open
Open
$output = "<div class='row' id='$selector'>";
- Exclude checks
Tabs must be used to indent lines; spaces are not allowed Open
Open
break;
- Exclude checks