vpietri/magento2-developer-quickdevbar

View on GitHub

Showing 185 of 185 total issues

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

    protected function getWrapperBaseFilename($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 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

Missing class import via use statement (line '375', 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 '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 '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 '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 loadDataFromFile has a boolean flag argument $ajax, which is a certain sign of a Single Responsibility Principle violation.
Open

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

Function _getElementHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _getElementHtml(AbstractElement $element)
    {
        $html = [];
        if ($this->_qdbHelper->isToolbarAccessAllowed(true)) {
            $html[] = __('Yep');
Severity: Minor
Found in Block/Adminhtml/System/Config/Form/Fieldset/IsEnabled.php - About 25 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

Function pullData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function pullData()
    {
        $preferences = array();
        foreach ($this->config->getPreferences() as $type => $preference) {
            if(preg_match('/^(\w+\\\\\w+)/', $type, $matches)) {
Severity: Minor
Found in Service/Config.php - About 25 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

Function execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {

        $this->resourceConfig->saveConfig('dev/quickdevbar/enable', $this->status);
        $output->writeln("<info>" . $this->message . "</info>");
Severity: Minor
Found in Console/Command/AbstractStatusToolbar.php - About 25 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

Function computeQueryGrade has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function computeQueryGrade($allQueries, $shortestQueryTime, $longestQueryTime, $totalNumQueries, $average)
    {
        $squareSum = 0;
        foreach ($allQueries as $index => $query) {
            $squareSum = pow($query['time'] - $average, 2);
Severity: Minor
Found in Service/Sql.php - About 25 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

Avoid unused parameters such as '$data'.
Open

        string $data,
Severity: Minor
Found in Plugin/Framework/App/Cache.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$data'.
Open

        string $data,

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

The method pullData() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
Open

    public function pullData()
    {
        $request = $this->requestHttp;
        $requestData = [];
        $requestData[] = ['name' => 'Date sys', 'value' => date("Y-m-d H:i:s")];
Severity: Minor
Found in Service/Request.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method getWrapperContent() has an NPath complexity of 240. The configured NPath complexity threshold is 200.
Open

    public function getWrapperContent($ajax = false)
    {
//Clean old files
//        /** @var \SplFileInfo $fileInfo */
//        foreach (new \DirectoryIterator($this->getQdbTempDir()) as $fileInfo) {
Severity: Minor
Found in Helper/Data.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid unused local variables such as '$error'.
Open

            $error = true;
Severity: Minor
Found in Controller/Action/Cache.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid unused parameters such as '$query'.
Open

    public function addQuery(array $query, array $result)
Severity: Minor
Found in Service/Elasticsearch.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Avoid unused parameters such as '$input'.
Open

    protected function getProfilerClass(InputInterface $input)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Severity
Category
Status
Source
Language