vpietri/magento2-developer-quickdevbar

View on GitHub

Showing 169 of 169 total issues

Function tailFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    function tailFile($filepath, $lines = 1, $adaptive = true)
    {
        // Open file
        $f = @fopen($filepath, "rb");
        if ($f === false) {
Severity: Minor
Found in Helper/Data.php - About 35 mins 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

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

    protected function getWrapperFilename($ajax = false)
Severity: Minor
Found in Helper/Data.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

Missing class import via use statement (line '77', column '27').
Open

        $serializer = new \Magento\Framework\Serialize\Serializer\Json();
Severity: Minor
Found in Helper/Register.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

    public function isAjax($asString = true)
Severity: Minor
Found in Block/Tab/Panel.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

Missing class import via use statement (line '74', column '27').
Open

        $reflection = new \ReflectionClass($layout);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '59', column '27').
Open

                throw new \Exception('Key is missing');
Severity: Minor
Found in Controller/Action/ConfigUpdate.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '407', column '30').
Open

            $reflector = new \ReflectionClass($class);
Severity: Minor
Found in Helper/Data.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

    public function getAllowedIps($separator = false)
Severity: Minor
Found in Helper/Data.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

Remove error control operator '@' on line 247.
Open

    function tailFile($filepath, $lines = 1, $adaptive = true)
    {
        // Open file
        $f = @fopen($filepath, "rb");
        if ($f === false) {
Severity: Minor
Found in Helper/Data.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

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

    public function setWrapperContent($content, $ajax = false)
Severity: Minor
Found in Helper/Data.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

Missing class import via use statement (line '79', column '39').
Open

                            throw new \Exception('Scope auto is unrecognized');
Severity: Minor
Found in Controller/Action/ConfigUpdate.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

    public function getWrapperContent($ajax = false)
Severity: Minor
Found in Helper/Data.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 isToolbarAccessAllowed has a boolean flag argument $testWithRestriction, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function isToolbarAccessAllowed($testWithRestriction=false)
Severity: Minor
Found in Helper/Data.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

Missing class import via use statement (line '135', column '44').
Open

                    $reflectionClass = new \ReflectionClass($block);

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '73', column '23').
Open

            throw new \Exception('property qdbDataKey is not defined.');
Severity: Minor
Found in Block/Tab/Panel.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

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

    function tailFile($filepath, $lines = 1, $adaptive = true)
Severity: Minor
Found in Helper/Data.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 getLogFiles has a boolean flag argument $key, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function getLogFiles($key = false)
Severity: Minor
Found in Helper/Data.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

Missing class import via use statement (line '340', column '22').
Open

        foreach (new \DirectoryIterator($this->getQdbTempDir()) as $fileInfo) {
Severity: Minor
Found in Helper/Data.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '42', column '38').
Open

            $this->sqlProfiler = new \Zend_Db_Profiler();
Severity: Minor
Found in Service/Sql.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '29', column '31').
Open

            $reflection = new \ReflectionClass($this->pluginList);
Severity: Minor
Found in Service/Plugin.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Severity
Category
Status
Source
Language