propelorm/Propel2

View on GitHub

Showing 740 of 740 total issues

Function addForeignKeys has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addForeignKeys(Table $table, int $oid): void
    {
        $database = $table->getDatabase();
        $stmt = $this->dbh->prepare("SELECT
            conname,
Severity: Minor
Found in src/Propel/Generator/Reverse/PgsqlSchemaParser.php - About 3 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 addCrossFkScheduledForDeletion has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addCrossFkScheduledForDeletion(string &$script, CrossForeignKeys $crossFKs): void
    {
        $multipleFks = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
        $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
        $queryClassName = $this->getNewStubQueryBuilder($crossFKs->getMiddleTable())->getClassname();
Severity: Minor
Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 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 addClassBody has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addClassBody(string &$script): void
    {
        $this->declareClassFromBuilder($this->getStubObjectBuilder());
        $this->declareClassFromBuilder($this->getStubQueryBuilder());
        $this->declareClassFromBuilder($this->getTableMapBuilder());
Severity: Major
Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 hrs to fix

    File ConnectionWrapper.php has 308 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/Connection/ConnectionWrapper.php - About 3 hrs to fix

      Method getColumnFromRow has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getColumnFromRow(array $row, Table $table): Column
          {
              $name = $row['Field'];
              $isNullable = ($row['Null'] === 'YES');
              $autoincrement = (strpos($row['Extra'], 'auto_increment') !== false);
      Severity: Major
      Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php - About 3 hrs to fix

        Method addFindPkSimple has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function addFindPkSimple(string &$script): void
            {
                $table = $this->getTable();
        
                // this method is not needed if the table has no primary key
        Severity: Major
        Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 3 hrs to fix

          RelationMap has 28 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class RelationMap
          {
              // types
              /**
               * @var int
          Severity: Minor
          Found in src/Propel/Runtime/Map/RelationMap.php - About 3 hrs to fix

            Domain has 28 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Domain extends MappingModel
            {
                /**
                 * @var string|null
                 */
            Severity: Minor
            Found in src/Propel/Generator/Model/Domain.php - About 3 hrs to fix

              Method execute has 83 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function execute(InputInterface $input, OutputInterface $output): int
                  {
                      $consoleHelper = new ConsoleHelper($input, $output);
                      $this->getHelperSet()->set($consoleHelper);
              
              
              Severity: Major
              Found in src/Propel/Generator/Command/InitCommand.php - About 3 hrs to fix

                Method addPopulateFromVersion has 83 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function addPopulateFromVersion(string &$script): void
                    {
                        $ARclassName = $this->getActiveRecordClassName();
                        $versionTable = $this->behavior->getVersionTable();
                        $versionColumnName = $versionTable->getColumn($this->behavior->getParameter('version_column'))->getPhpName();

                  Function getCriterionForClause has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getCriterionForClause(string $clause, $value, ?int $bindingType = null): AbstractCriterion
                      {
                          $origin = $clause = trim($clause);
                          if ($this->replaceNames($clause)) {
                              // at least one column name was found and replaced in the clause
                  Severity: Minor
                  Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 3 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 getReverseDiff has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getReverseDiff(): self
                      {
                          $diff = new self();
                  
                          // tables
                  Severity: Minor
                  Found in src/Propel/Generator/Model/Diff/TableDiff.php - About 3 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 insertSql has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function insertSql(?string $datasource = null): bool
                      {
                          $statementsToInsert = [];
                          foreach ($this->getProperties($this->getSqlDbMapFilename()) as $sqlFile => $database) {
                              if ($datasource !== null && $database !== $datasource) {
                  Severity: Minor
                  Found in src/Propel/Generator/Manager/SqlManager.php - About 3 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 loadDataModels has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function loadDataModels(): void
                      {
                          $schemas = [];
                          $totalNbTables = 0;
                          $dataModelFiles = $this->getSchemas();
                  Severity: Minor
                  Found in src/Propel/Generator/Manager/AbstractManager.php - About 3 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 buildFixtures has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function buildFixtures(string $fixturesDir, array $connections, InputInterface $input, OutputInterface $output): int
                      {
                          if (!file_exists($this->root . '/' . $fixturesDir)) {
                              $output->writeln(sprintf('<error>Directory "%s" not found.</error>', $fixturesDir));
                  
                  
                  Severity: Major
                  Found in src/Propel/Generator/Command/TestPrepareCommand.php - About 3 hrs to fix

                    File Collection.php has 297 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/Collection/Collection.php - About 3 hrs to fix

                      Method getModifyColumnDDL has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getModifyColumnDDL(ColumnDiff $columnDiff): string
                          {
                              $ret = '';
                              $changedProperties = $columnDiff->getChangedProperties();
                      
                      
                      Severity: Major
                      Found in src/Propel/Generator/Platform/PgsqlPlatform.php - About 3 hrs to fix

                        Function getDatabases has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getDatabases(): array
                            {
                                if ($this->databases === null) {
                                    $databases = [];
                                    foreach ($this->getDataModels() as $dataModel) {
                        Severity: Minor
                        Found in src/Propel/Generator/Manager/AbstractManager.php - About 3 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 addInitialize has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function addInitialize(string &$script): void
                            {
                                $table = $this->getTable();
                                /** @var \Propel\Generator\Platform\DefaultPlatform $platform */
                                $platform = $this->getPlatform();
                        Severity: Major
                        Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 3 hrs to fix

                          Method getNextStatement has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getNextStatement(): string
                              {
                                  $isAfterBackslash = false;
                                  $isCommentLine = false;
                                  $isInString = false;
                          Severity: Major
                          Found in src/Propel/Generator/Util/SqlParser.php - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language