vpietri/magento2-developer-quickdevbar

View on GitHub

Showing 48 of 185 total issues

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

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

Severity
Category
Status
Source
Language