bcit-ci/CodeIgniter

View on GitHub
system/libraries/Migration.php

Summary

Maintainability
C
1 day
Test Coverage

Function version has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function version($target_version)
    {
        // Note: We use strings, so that timestamp versions work on 32-bit systems
        $current_version = $this->_get_version();

Severity: Minor
Found in system/libraries/Migration.php - About 4 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

Method version has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function version($target_version)
    {
        // Note: We use strings, so that timestamp versions work on 32-bit systems
        $current_version = $this->_get_version();

Severity: Major
Found in system/libraries/Migration.php - About 3 hrs to fix

    Method __construct has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($config = array())
        {
            // Only run this constructor on main library load
            if ( ! in_array(get_class($this), array('CI_Migration', config_item('subclass_prefix').'Migration'), TRUE))
            {
    Severity: Minor
    Found in system/libraries/Migration.php - About 1 hr to fix

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

          public function __construct($config = array())
          {
              // Only run this constructor on main library load
              if ( ! in_array(get_class($this), array('CI_Migration', config_item('subclass_prefix').'Migration'), TRUE))
              {
      Severity: Minor
      Found in system/libraries/Migration.php - About 45 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 too many return statements within this method.
      Open

                      return FALSE;
      Severity: Major
      Found in system/libraries/Migration.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $current_version;
        Severity: Major
        Found in system/libraries/Migration.php - About 30 mins to fix

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

              public function find_migrations()
              {
                  $migrations = array();
          
                  // Load all *_*.php files in the migrations path
          Severity: Minor
          Found in system/libraries/Migration.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

          There are no issues that match your filters.

          Category
          Status