propelorm/Propel2

View on GitHub
src/Propel/Generator/Platform/SqlitePlatform.php

Summary

Maintainability
D
2 days
Test Coverage

File SqlitePlatform.php has 361 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
Severity: Minor
Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 4 hrs to fix

    Function normalizeTable has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        public function normalizeTable(Table $table)
        {
            if ($table->getPrimaryKey()) {
                //search if there is already a UNIQUE constraint over the primary keys
                $pkUniqueExist = false;
    Severity: Minor
    Found in src/Propel/Generator/Platform/SqlitePlatform.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

    SqlitePlatform has 29 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SqlitePlatform extends DefaultPlatform
    {
        /**
         * If we should generate FOREIGN KEY statements.
         * This is since SQLite version 3.6.19 possible.
    Severity: Minor
    Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 3 hrs to fix

      Consider simplifying this complex logical expression.
      Open

              if ($this->tableAlteringWorkaround && !$changedNotEditableThroughDirectDDL && $tableDiff->hasAddedColumns()) {
      
                  $addedCols = $tableDiff->getAddedColumns();
                  foreach ($addedCols as $column) {
      
      
      Severity: Critical
      Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

        Method getMigrationTableDDL has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getMigrationTableDDL(TableDiff $tableDiff)
            {
                $pattern = "
        CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s;
        DROP TABLE %s;
        Severity: Minor
        Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

          Function getModifyTableDDL has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getModifyTableDDL(TableDiff $tableDiff)
              {
                  $changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (false
                      || $tableDiff->hasModifiedFks()
                      || $tableDiff->hasModifiedIndices()
          Severity: Minor
          Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr 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 getAddTableDDL has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getAddTableDDL(Table $table)
              {
                  $table = clone $table;
                  $tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : '';
          
          
          Severity: Minor
          Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr 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 getAddTableDDL has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAddTableDDL(Table $table)
              {
                  $table = clone $table;
                  $tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : '';
          
          
          Severity: Minor
          Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

            Method getModifyTableDDL has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getModifyTableDDL(TableDiff $tableDiff)
                {
                    $changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (false
                        || $tableDiff->hasModifiedFks()
                        || $tableDiff->hasModifiedIndices()
            Severity: Minor
            Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

              Method normalizeTable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function normalizeTable(Table $table)
                  {
                      if ($table->getPrimaryKey()) {
                          //search if there is already a UNIQUE constraint over the primary keys
                          $pkUniqueExist = false;
              Severity: Minor
              Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

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

                    public function getMigrationTableDDL(TableDiff $tableDiff)
                    {
                        $pattern = "
                CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s;
                DROP TABLE %s;
                Severity: Minor
                Found in src/Propel/Generator/Platform/SqlitePlatform.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

                There are no issues that match your filters.

                Category
                Status