propelorm/Propel2

View on GitHub

Showing 693 of 740 total issues

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

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

                    public function objectMethods(ObjectBuilder $builder): string
                    {
                        $this->setBuilder($builder);
                        $script = '';
                
                

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

                      protected function execute(InputInterface $input, OutputInterface $output): int
                      {
                          $configOptions = [];
                          $inputOptions = $input->getOptions();
                  
                  
                  Severity: Major
                  Found in src/Propel/Generator/Command/ModelBuildCommand.php - About 2 hrs to fix

                    Method addForeignKeys has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function addForeignKeys(Table $table): void
                        {
                            $database = $table->getDatabase();
                    
                            $dataFetcher = $this->dbh->query(sprintf('SHOW CREATE TABLE %s', $this->getPlatform()->doQuoting($table->getName())));
                    Severity: Major
                    Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php - About 2 hrs to fix

                      File StandardServiceContainer.php has 289 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/ServiceContainer/StandardServiceContainer.php - About 2 hrs to fix

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

                            public function doUpdate($updateValues, ConnectionInterface $con, bool $forceIndividualSaves = false): int
                            {
                                if ($forceIndividualSaves) {
                                    if ($updateValues instanceof Criteria) {
                                        throw new LogicException('Parameter #1 `$updateValues` must be an array while `$forceIndividualSaves = true`.');
                        Severity: Minor
                        Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 __call has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __call(string $name, array $arguments)
                            {
                                // Maybe it's a magic call to one of the methods supporting it, e.g. 'findByTitle'
                                static $methods = ['findBy', 'findOneBy', 'requireOneBy', 'filterBy', 'orderBy', 'groupBy'];
                                foreach ($methods as $methodName) {
                        Severity: Minor
                        Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.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 getAllObjectsFromRow has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getAllObjectsFromRow(array $row): ActiveRecordInterface
                            {
                                $col = 0;
                        
                                // main object
                        Severity: Minor
                        Found in src/Propel/Runtime/Formatter/OnDemandFormatter.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 getAllObjectsFromRow has a Cognitive Complexity of 21 (exceeds 5 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 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

                        Severity
                        Category
                        Status
                        Source
                        Language