bcit-ci/CodeIgniter

View on GitHub

Showing 865 of 865 total issues

CI_User_agent has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class CI_User_agent {

    /**
     * Current user-agent
     *
Severity: Minor
Found in system/libraries/User_agent.php - About 2 hrs to fix

    CI_DB_forge has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class CI_DB_forge {
    
        /**
         * Database object
         *
    Severity: Minor
    Found in system/database/DB_forge.php - About 2 hrs to fix

      File URI.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * CodeIgniter
       *
       * An open source application development framework for PHP
      Severity: Minor
      Found in system/core/URI.php - About 2 hrs to fix

        Method load_driver has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function load_driver($child)
            {
                // Get CodeIgniter instance and subclass prefix
                $prefix = config_item('subclass_prefix');
        
        
        Severity: Major
        Found in system/libraries/Driver.php - About 2 hrs to fix

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

              public function valid_email($email)
              {
                  if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $email, $matches))
                  {
                      $domain = defined('INTL_IDNA_VARIANT_UTS46')
          Severity: Major
          Found in system/libraries/Email.php and 1 other location - About 2 hrs to fix
          system/libraries/Form_validation.php on lines 1239..1254

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

          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 valid_email($str)
              {
                  if (function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#', $str, $matches))
                  {
                      $domain = defined('INTL_IDNA_VARIANT_UTS46')
          Severity: Major
          Found in system/libraries/Form_validation.php and 1 other location - About 2 hrs to fix
          system/libraries/Email.php on lines 1014..1029

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

          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 _ci_load has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _ci_load($_ci_data)
              {
                  // Set the default data variables
                  foreach (array('_ci_view', '_ci_vars', '_ci_path', '_ci_return') as $_ci_val)
                  {
          Severity: Major
          Found in system/core/Loader.php - About 2 hrs to fix

            Function __construct has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct(array $params = array())
                {
                    // No sessions under CLI
                    if (is_cli())
                    {
            Severity: Minor
            Found in system/libraries/Session/Session.php - About 2 hrs 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 _parse_form_attributes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                function _parse_form_attributes($attributes, $default)
                {
                    if (is_array($attributes))
                    {
                        foreach ($default as $key => $val)
            Severity: Minor
            Found in system/helpers/form_helper.php - About 2 hrs 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 _run_hook has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _run_hook($data)
                {
                    // Closures/lambda functions and array($object, 'method') callables
                    if (is_callable($data))
                    {
            Severity: Minor
            Found in system/core/Hooks.php - About 2 hrs 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 DB_result.php has 281 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * CodeIgniter
             *
             * An open source application development framework for PHP
            Severity: Minor
            Found in system/database/DB_result.php - About 2 hrs to fix

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

                  protected function _attr_type(&$attributes)
                  {
                      // Reset field lengths for data types that don't support it
                      if (isset($attributes['CONSTRAINT']) && stripos($attributes['TYPE'], 'int') !== FALSE)
                      {
              Severity: Major
              Found in system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php and 1 other location - About 2 hrs to fix
              system/database/drivers/postgre/postgre_forge.php on lines 165..185

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

              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

                  protected function _attr_type(&$attributes)
                  {
                      // Reset field lengths for data types that don't support it
                      if (isset($attributes['CONSTRAINT']) && stripos($attributes['TYPE'], 'int') !== FALSE)
                      {
              Severity: Major
              Found in system/database/drivers/postgre/postgre_forge.php and 1 other location - About 2 hrs to fix
              system/database/drivers/pdo/subdrivers/pdo_pgsql_forge.php on lines 177..197

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

              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 _file_mime_type has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _file_mime_type($file)
                  {
                      // We'll need this to validate the MIME info string (e.g. text/plain; charset=us-ascii)
                      $regexp = '/^([a-z\-]+\/[a-z0-9\-\.\+]+)(;\s.+)?$/';
              
              
              Severity: Major
              Found in system/libraries/Upload.php - About 2 hrs to fix

                Method overlay_watermark has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function overlay_watermark()
                    {
                        if ( ! function_exists('imagecolortransparent'))
                        {
                            $this->set_error('imglib_gd_required');
                Severity: Major
                Found in system/libraries/Image_lib.php - About 2 hrs to fix

                  Method _run_hook has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function _run_hook($data)
                      {
                          // Closures/lambda functions and array($object, 'method') callables
                          if (is_callable($data))
                          {
                  Severity: Major
                  Found in system/core/Hooks.php - About 2 hrs to fix

                    Method _write_cache has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function _write_cache($output)
                        {
                            $CI =& get_instance();
                            $path = $CI->config->item('cache_path');
                            $cache_path = ($path === '') ? APPPATH.'cache'.DIRECTORY_SEPARATOR : rtrim($path, '/\\').DIRECTORY_SEPARATOR;
                    Severity: Major
                    Found in system/core/Output.php - About 2 hrs to fix

                      Function ascii_to_entities has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          function ascii_to_entities($str)
                          {
                              $out = '';
                              $length = defined('MB_OVERLOAD_STRING')
                                  ? mb_strlen($str, '8bit') - 1
                      Severity: Minor
                      Found in system/helpers/text_helper.php - About 2 hrs 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 initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function initialize()
                          {
                              /* If an established connection is available, then there's
                               * no need to connect and select the database.
                               *
                      Severity: Minor
                      Found in system/database/DB_driver.php - About 2 hrs 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_cookie has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function set_cookie($name, $value = '', $expire = 0, $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL, $samesite = NULL)
                          {
                              if (is_array($name))
                              {
                                  // always leave 'name' in last place, as the loop will break otherwise, due to $$item
                      Severity: Minor
                      Found in system/core/Input.php - About 2 hrs 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