vpietri/magento2-developer-quickdevbar

View on GitHub

Showing 185 of 185 total issues

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Framework\App\Config $appConfig,
        \ADM\QuickDevBar\Helper\Data $qdbHelper,
        \ADM\QuickDevBar\Helper\Register $qdbHelperRegister,
        array $data = []
Severity: Minor
Found in Block/Tab/Content/Config.php - About 35 mins to fix

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

        public function dumpToFile()
        {
            $isAjax = $this->_getRequest()->isAjax();
            if($this->_getRequest() && $this->_getRequest()->getModuleName()=='quickdevbar') {
                return false;
    Severity: Minor
    Found in Helper/Register.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

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

        protected function loadModuleTranslationByModulesList(array $modules)
        {
            foreach ($modules as $module) {
                $moduleFilePath = $this->_getModuleTranslationFile($module, $this->getLocale());
                $relativePath = $this->_getRelativeFilePath($moduleFilePath);
    Severity: Minor
    Found in Helper/Translate.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

    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

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

        protected function _loadThemeTranslation()
        {
            $file = $this->_getThemeTranslationFile($this->getLocale());
            if ($file) {
                $relativePath = $this->_getRelativeFilePath($file);
    Severity: Minor
    Found in Helper/Translate.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

    Remove error control operator '@' on line 252.
    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

    Missing class import via use statement (line '440', 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

    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

    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 '66', column '27').
    Open

                    throw new \Exception('Scope 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

    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 '346', 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 '356', column '27').
    Open

            $serializer = new \Magento\Framework\Serialize\Serializer\Json();
    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 '74', 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

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

            $dumper = new \Symfony\Component\VarDumper\Dumper\HtmlDumper();

    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

    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 '72', column '23').
    Open

            $cloner = new \Symfony\Component\VarDumper\Cloner\VarCloner();

    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 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

    Severity
    Category
    Status
    Source
    Language