qcubed/framework

View on GitHub

Showing 15,774 of 15,774 total issues

Function DisplayHtml has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

        public static function DisplayHtml($strText, $strCssClass) {
            $strText = trim(str_replace("\r", '', $strText));
            $strToReturn = '';

            $objStateStack = new QStack();
Severity: Minor
Found in includes/base_controls/QWriteBox.class.php - About 1 day 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 __construct has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

        public function __construct($objSettingsXml) {
            parent::__construct($objSettingsXml);
            // Make settings file accessible to templates
            //$this->objSettingsXml = $objSettingsXml;

Severity: Minor
Found in includes/codegen/QDatabaseCodeGen.class.php - About 1 day 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public function __set($strName, $mixValue) {
            $this->blnModified = true;

            switch ($strName) {
                // APPEARANCE
Severity: Major
Found in includes/base_controls/QWaitIcon.class.php and 1 other location - About 1 day to fix
includes/base_controls/QImageBase.class.php on lines 418..476

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 293.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        public function __set($strName, $mixValue) {
            $this->blnModified = true;

            switch ($strName) {
                case "CacheFolder":
Severity: Major
Found in includes/base_controls/QImageBase.class.php and 1 other location - About 1 day to fix
includes/base_controls/QWaitIcon.class.php on lines 151..210

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 293.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function SqlVariable has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
Open

        public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
            // Are we SqlVariabling a BOOLEAN value?
            if (is_bool($mixData)) {
                // Yes
                if ($blnIncludeEquality) {
Severity: Minor
Found in includes/framework/QDatabaseBase.class.php - About 1 day 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

File QDataGridLegacyColumn.class.php has 588 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
    /**
     * This file contains the QDataGridEgacyColumn and QFilterType class.
     *
     * @package Controls
Severity: Major
Found in includes/base_controls/QDataGridLegacyColumn.class.php - About 1 day to fix

    Function Validate has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function Validate() {
            $result = array();
            
            if(ini_get('safe_mode') ){
                $obj = new QInstallationValidationResult();
    Severity: Minor
    Found in includes/framework/QInstallationValidator.class.php - About 1 day 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 SqlVariable has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

            public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                    // Are we SqlVariabling a BOOLEAN value?
                    if (is_bool($mixData)) {
                            // Yes
                            if ($blnIncludeEquality) {
    Severity: Minor
    Found in includes/database/QPostgreSqlPdoDatabase.class.php - About 1 day 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            private function ParseColumnNameArrayFromKeyDefinition($strKeyDefinition) {
                $strKeyDefinition = trim($strKeyDefinition);
                
                // Get rid of the opening "(" and the closing ")"
                $intPosition = strpos($strKeyDefinition, '(');
    Severity: Major
    Found in includes/database/QMySqliDatabase.class.php and 1 other location - About 1 day to fix
    includes/database/QOracleDatabase.class.php on lines 413..442

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 287.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        private function ParseColumnNameArrayFromKeyDefinition($strKeyDefinition) {
            $strKeyDefinition = trim($strKeyDefinition);
    
            // Get rid of the opening "(" and the closing ")"
            $intPosition = strpos($strKeyDefinition, '(');
    Severity: Major
    Found in includes/database/QOracleDatabase.class.php and 1 other location - About 1 day to fix
    includes/database/QMySqliDatabase.class.php on lines 247..276

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 287.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method __set has 248 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function __set($strName, $mixValue) {
                switch ($strName) {
                    // APPEARANCE
                    case "AlternateRowStyle":
                        try {
    Severity: Major
    Found in includes/base_controls/QDataGridLegacyBase.class.php - About 1 day to fix

      Function SqlVariable has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
      Open

              public function SqlVariable($mixData, $blnIncludeEquality = false, $blnReverseEquality = false) {
                  // Are we SqlVariabling a BOOLEAN value?
                  if (is_bool($mixData)) {
                      // Yes
                      if ($blnIncludeEquality) {
      Severity: Minor
      Found in includes/database/QPostgreSqlDatabase.class.php - About 1 day 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

      File QPostgreSqlDatabase.class.php has 579 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
          /* QCubed Development Framework for PHP
           * http://www.qcu.be/
           *
           * Copyright (C) 2006
      Severity: Major
      Found in includes/database/QPostgreSqlDatabase.class.php - About 1 day to fix

        Function registerControl has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
        Open

        qcubed.registerControl = function(mixControl) {
            var objControl = qcubed.getControl(mixControl),
                objWrapper;
        
            if (!objControl) {
        Severity: Minor
        Found in assets/js/qcubed.js - About 1 day 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 __set has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
        Open

                public function __set($strName, $mixValue) {
                    $this->blnModified = true;
        
                    switch ($strName) {
                        // APPEARANCE
        Severity: Minor
        Found in includes/base_controls/QImageLabelBase.class.php - About 1 day 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 ExplainStatement has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
        Open

                public function ExplainStatement($sql) {
                    // As of MySQL 5.6.3, EXPLAIN provides information about
                    // SELECT, DELETE, INSERT, REPLACE, and UPDATE statements.
                    // Before MySQL 5.6.3, EXPLAIN provides information only about SELECT statements.
                    
        Severity: Minor
        Found in includes/database/QMySqliDatabase.class.php - About 1 day 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 ajax has 240 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ajax: function( url, options ) {
        
                // If url is an object, simulate pre-1.5 signature
                if ( typeof url === "object" ) {
                    options = url;
        Severity: Major
        Found in assets/js/jquery/jquery.js - About 1 day to fix

          File _actions.inc.php has 564 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
              /**
               * This file contains all basic action classes: QAction, QServerAction, QAjaxAction, etc.
               *
               * @package Actions
          Severity: Major
          Found in includes/base_controls/_actions.inc.php - About 1 day to fix

            Method '_generateHTML' has a complexity of 72.
            Open

                _generateHTML: function(inst) {
            Severity: Minor
            Found in assets/js/jquery/jquery-ui.custom.js by eslint

            Limit Cyclomatic Complexity (complexity)

            Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

            function a(x) {
                if (true) {
                    return x; // 1st path
                } else if (false) {
                    return x+1; // 2nd path
                } else {
                    return 4; // 3rd path
                }
            }

            Rule Details

            This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

            Examples of incorrect code for a maximum of 2:

            /*eslint complexity: ["error", 2]*/
            
            function a(x) {
                if (true) {
                    return x;
                } else if (false) {
                    return x+1;
                } else {
                    return 4; // 3rd path
                }
            }

            Examples of correct code for a maximum of 2:

            /*eslint complexity: ["error", 2]*/
            
            function a(x) {
                if (true) {
                    return x;
                } else {
                    return 4;
                }
            }

            Options

            Optionally, you may specify a max object property:

            "complexity": ["error", 2]

            is equivalent to

            "complexity": ["error", { "max": 2 }]

            Deprecated: the object property maximum is deprecated. Please use the property max instead.

            When Not To Use It

            If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

            Further Reading

            Related Rules

            • [max-depth](max-depth.md)
            • [max-len](max-len.md)
            • [max-nested-callbacks](max-nested-callbacks.md)
            • [max-params](max-params.md)
            • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            class QPostgreSqlPdoDatabaseRow extends QDatabaseRowBase {
                    protected $strColumnArray;
            
                    public function __construct($strColumnArray) {
                        $this->strColumnArray = $strColumnArray;
            Severity: Major
            Found in includes/database/QPostgreSqlPdoDatabase.class.php and 2 other locations - About 1 day to fix
            includes/database/QInformixPdoDatabase.class.php on lines 651..714
            includes/database/QSqLite3PdoDatabase.class.php on lines 339..403

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 272.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language