propelorm/Propel2

View on GitHub

Showing 693 of 740 total issues

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

    public function getColumnDDL(Column $col): string
    {
        $domain = $col->getDomain();

        $ddl = [$this->quoteIdentifier($col->getName())];
Severity: Minor
Found in src/Propel/Generator/Platform/PgsqlPlatform.php - About 1 hr to fix

    Method queryMethods has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function queryMethods(AbstractOMBuilder $builder): string
        {
            $script = '';
    
            if ($this->withUpdatedAt()) {

      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 getColumnFromName has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getColumnFromName(string $columnName, bool $failSilently = true): array
            {
                if (strpos($columnName, '.') === false) {
                    $prefix = (string)$this->getModelAliasOrName();
                } else {
        Severity: Minor
        Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

              protected function executeRollbackForDatasource(string $datasource, string $sql): void
              {
                  $connection = $this->migrationManager->getConnection($datasource);
          
                  if ($this->isVerbose()) {
          Severity: Minor
          Found in src/Propel/Generator/Command/Executor/RollbackExecutor.php - About 1 hr to fix

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

                protected function addFieldsAttributes(): string
                {
                    $tableColumns = $this->getTable()->getColumns();
            
                    $fieldNamesPhpName = '';
            Severity: Minor
            Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

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

                  public function build(): void
                  {
                      foreach ($this->getDatabases() as $database) {
                          $dotSyntax = "digraph G {\n";
              
              
              Severity: Minor
              Found in src/Propel/Generator/Manager/GraphvizManager.php - About 1 hr to fix

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

                    public function join(string $relation, string $joinType = Criteria::INNER_JOIN)
                    {
                        // relation looks like '$leftName.$relationName $relationAlias'
                        [$fullName, $relationAlias] = self::getClassAndAlias($relation);
                        if (strpos($fullName, '.') === false) {
                Severity: Minor
                Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

                  Method fixNamespaceDeclarations has 40 lines of code (exceeds 25 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 1 hr to fix

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

                        protected function addShiftRLValues(string &$script): void
                        {
                            $objectClassName = $this->objectClassName;
                            $useScope = $this->behavior->useScope();
                            $tableMapClassName = $this->builder->getTableMapClass();

                      Function buildFixtures has a Cognitive Complexity of 13 (exceeds 5 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: Minor
                      Found in src/Propel/Generator/Command/TestPrepareCommand.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 format has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function format(?DataFetcherInterface $dataFetcher = null)
                          {
                              $this->checkInit();
                              if ($dataFetcher) {
                                  $this->setDataFetcher($dataFetcher);
                      Severity: Minor
                      Found in src/Propel/Runtime/Formatter/ObjectFormatter.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 addClassBody has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function addClassBody(string &$script): void
                          {
                              $table = $this->getTable();
                      
                              // namespaces
                      Severity: Minor
                      Found in src/Propel/Generator/Builder/Om/QueryBuilder.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 declareClassNamespace has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function declareClassNamespace(string $class, string $namespace = '', $alias = false): string
                          {
                              $namespace = trim($namespace, '\\');
                      
                              // check if the class is already declared
                      Severity: Minor
                      Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.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 mergeStatements has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function mergeStatements(string $sql): string
                          {
                              $sqlParser = new SqlParser();
                              $sqlParser->setSQL($sql);
                              $statements = $sqlParser->explodeIntoStatements();
                      Severity: Minor
                      Found in src/Propel/Generator/Platform/Util/AlterTableStatementMerger.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 buildConnectionToVariableNameMap has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected static function buildConnectionToVariableNameMap(array $migrationsUp, array $migrationsDown): array
                          {
                              $connectionToVariableName = [];
                              foreach ([$migrationsUp, $migrationsDown] as $migrations) {
                                  $connectionNames = array_keys($migrations);
                      Severity: Minor
                      Found in src/Propel/Generator/Manager/MigrationManager.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 getConfiguredSchemaParser has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getConfiguredSchemaParser(?ConnectionInterface $con = null, $database = null): ?SchemaParserInterface
                          {
                              $reverse = $this->get()['migrations']['parserClass'];
                      
                              if ($reverse === null) {
                      Severity: Minor
                      Found in src/Propel/Generator/Config/GeneratorConfig.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 compareIndices has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function compareIndices(bool $caseInsensitive = false): int
                          {
                              $indexDifferences = 0;
                              $fromTableIndices = array_merge($this->getFromTable()->getIndices(), $this->getFromTable()->getUnices());
                              $toTableIndices = array_merge($this->getToTable()->getIndices(), $this->getToTable()->getUnices());
                      Severity: Minor
                      Found in src/Propel/Generator/Model/Diff/TableComparator.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 populateRelation has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function populateRelation(
                              string $relation,
                              ?Criteria $criteria = null,
                              ?ConnectionInterface $con = null
                          ) {
                      Severity: Minor
                      Found in src/Propel/Runtime/Collection/ObjectCollection.php - About 1 hr to fix

                        Method getAllObjectsFromRow has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getAllObjectsFromRow(array $row): ActiveRecordInterface
                            {
                                // main object
                                [$obj, $col] = $this->getTableMap()->populateObject($row, 0, $this->getDataFetcher()->getIndexType());
                        
                        
                        Severity: Minor
                        Found in src/Propel/Runtime/Formatter/ObjectFormatter.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language