propelorm/Propel2

View on GitHub

Showing 693 of 740 total issues

Function getColumnDefaultValueDDL has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function getColumnDefaultValueDDL(Column $col): string
    {
        $default = '';
        $defaultValue = $col->getDefaultValue();
        if ($defaultValue !== null) {
Severity: Minor
Found in src/Propel/Generator/Platform/DefaultPlatform.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

Method addGeneratorSection has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addGeneratorSection(ArrayNodeDefinition $node): void
    {
        $node
            ->children()
                ->arrayNode('generator')
Severity: Major
Found in src/Propel/Common/Config/PropelConfiguration.php - About 2 hrs to fix

    Method addToArray has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function addToArray(string &$script): void
        {
            $fks = $this->getTable()->getForeignKeys();
            $referrers = $this->getTable()->getReferrers();
            $hasFks = count($fks) > 0 || count($referrers) > 0;
    Severity: Major
    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

      Method addUpdateLoadedNodes has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addUpdateLoadedNodes(string &$script): void
          {
              $queryClassName = $this->queryClassName;
              $objectClassName = $this->objectClassName;
              $tableMapClassName = $this->tableMapClassName;

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

        class ModelWith
        {
            /**
             * @var string
             */
        Severity: Minor
        Found in src/Propel/Runtime/ActiveQuery/ModelWith.php - About 2 hrs to fix

          File PdoAdapter.php has 284 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/Runtime/Adapter/Pdo/PdoAdapter.php - About 2 hrs to fix

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

                public function modifyTable(): void
                {
                    $table = $this->getTable();
                    $parentTable = $this->getParentTable();
            
            

              Method addRuntimeSection has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addRuntimeSection(ArrayNodeDefinition $node): void
                  {
                      $node
                          ->children()
                              ->arrayNode('runtime')
              Severity: Major
              Found in src/Propel/Common/Config/PropelConfiguration.php - About 2 hrs to fix

                Method getColumnDDL has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getColumnDDL(Column $col): string
                    {
                        $domain = $col->getDomain();
                        $sqlType = $domain->getSqlType();
                        $notNullString = $this->getNullString($col->isNotNull());
                Severity: Major
                Found in src/Propel/Generator/Platform/MysqlPlatform.php - About 2 hrs to fix

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

                      private function parseKey(string $key, $rawValue, array &$config): void
                      {
                          $value = $rawValue;
                          if (is_string($rawValue)) {
                              if (strlen($rawValue) <= 5 && in_array(strtolower($rawValue), ['true', 'false'], true)) {
                  Severity: Minor
                  Found in src/Propel/Common/Config/Loader/IniFileLoader.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 fixNamespaceDeclarations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function fixNamespaceDeclarations(string $source): string
                      {
                          $cooperativeLexems = [T_WHITESPACE, T_NS_SEPARATOR, T_STRING];
                  
                          if (PHP_VERSION_ID >= 80000) {
                  Severity: Minor
                  Found in src/Propel/Generator/Util/QuickBuilder.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 addGetPrimaryKeyFromRow has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addGetPrimaryKeyFromRow(string &$script): void
                      {
                          $script .= "
                      /**
                       * Retrieves the primary key from the DB resultset row
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/TableMapBuilder.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 addFilterByCol has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addFilterByCol(string &$script, Column $col): void
                      {
                          $colPhpName = $col->getPhpName();
                          $colName = $col->getName();
                          $variableName = $col->getCamelCaseName();
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/QueryBuilder.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 isIndex has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isIndex(array $keys): bool
                      {
                          if ($this->indices) {
                              foreach ($this->indices as $index) {
                                  if (count($keys) === count($index->getColumns())) {
                  Severity: Minor
                  Found in src/Propel/Generator/Model/Table.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

                  Method addDoDelete has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function addDoDelete(string &$script): void
                      {
                          $table = $this->getTable();
                          $script .= "
                      /**
                  Severity: Major
                  Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 2 hrs to fix

                    Method __toString has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __toString(): string
                        {
                            $tables = [];
                            foreach ($this->getTables() as $table) {
                                $columns = [];
                    Severity: Major
                    Found in src/Propel/Generator/Model/Database.php - About 2 hrs to fix

                      AbstractFormatter has 24 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class AbstractFormatter
                      {
                          /**
                           * @var string|null
                           */
                      Severity: Minor
                      Found in src/Propel/Runtime/Formatter/AbstractFormatter.php - About 2 hrs to fix

                        ArchivableBehavior has 24 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ArchivableBehavior extends Behavior
                        {
                            /**
                             * Default parameters value
                             *
                        Severity: Minor
                        Found in src/Propel/Generator/Behavior/Archivable/ArchivableBehavior.php - About 2 hrs to fix

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

                              public function build(): void
                              {
                                  $this->validate();
                          
                                  $totalNbFiles = 0;
                          Severity: Major
                          Found in src/Propel/Generator/Manager/ModelManager.php - About 2 hrs to fix

                            Method addCrossFKDoAdd has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function addCrossFKDoAdd(string &$script, CrossForeignKeys $crossFKs): void
                                {
                                    $selfRelationNamePlural = $this->getFKPhpNameAffix($crossFKs->getIncomingForeignKey(), true);
                                    $relatedObjectClassName = $this->getCrossFKsPhpNameAffix($crossFKs, false);
                                    $className = $this->getClassNameFromTable($crossFKs->getIncomingForeignKey()->getTable());
                            Severity: Major
                            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language