propelorm/Propel2

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

Summary

Maintainability
F
3 days
Test Coverage

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

<?php

/**
 * MIT License. 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 5 hrs to fix

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

        public function normalizeTable(Table $table): void
        {
            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 31 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

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

          public function getModifyTableDDL(TableDiff $tableDiff): string
          {
              $changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (
                  $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

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

          public function getMigrationTableDDL(TableDiff $tableDiff): string
          {
              $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

        Consider simplifying this complex logical expression.
        Open

                if ($this->tableAlteringWorkaround && !$changedNotEditableThroughDirectDDL && $tableDiff->hasAddedColumns()) {
                    $addedCols = $tableDiff->getAddedColumns();
                    foreach ($addedCols as $column) {
                        $sqlChangeNotSupported =
                            //The column may not have a PRIMARY KEY or UNIQUE constraint.
        Severity: Critical
        Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

          Method getAddTableDDL has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAddTableDDL(Table $table): string
              {
                  $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 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getModifyTableDDL(TableDiff $tableDiff): string
                {
                    $changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (
                        $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): void
                  {
                      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 getAddTableDDL has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getAddTableDDL(Table $table): string
                    {
                        $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

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

                    public function getMigrationTableDDL(TableDiff $tableDiff): string
                    {
                        $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