propelorm/Propel2

View on GitHub

Showing 693 of 740 total issues

Function getTemplatePath has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getTemplatePath(string $path): string
    {
        $srcPos = strrpos($path, DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);
        if ($srcPos === false) {
            // BC shim for old template paths
Severity: Minor
Found in src/Propel/Common/Util/PathTrait.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 join has a Cognitive Complexity of 12 (exceeds 5 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

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 next has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function next(): void
    {
        $nextNode = null;
        $method = method_exists($this->curNode, 'retrieveNextSibling') ? 'retrieveNextSibling' : 'getNextSibling';
        if ($this->valid()) {
Severity: Minor
Found in src/Propel/Runtime/ActiveRecord/NestedSetRecursiveIterator.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 formatRow has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function formatRow(array $row): array
    {
        foreach ($row as &$column) {
            if (!is_scalar($column)) {
                $column = $this->serialize($column);
Severity: Minor
Found in src/Propel/Runtime/Parser/CsvParser.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 applyBehaviorModifierBase has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function applyBehaviorModifierBase(string $hookName, string $modifier, string &$script, string $tab = '        '): void
    {
        $modifierGetter = 'get' . $modifier;
        foreach ($this->getTable()->getBehaviors() as $behavior) {
            $modifier = $behavior->$modifierGetter();
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 getRefRelatedBySuffix has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function getRefRelatedBySuffix(ForeignKey $fk): string
    {
        $relCol = '';
        foreach ($fk->getMapping() as $mapping) {
            [$localColumn, $foreignValueOrColumn] = $mapping;
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 getUseStatements has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUseStatements(?string $ignoredNamespace = null): string
    {
        $script = '';
        $declaredClasses = $this->declaredClasses;
        unset($declaredClasses[$ignoredNamespace]);
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 getSequenceName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSequenceName(Table $table): ?string
    {
        static $longNamesMap = [];
        $result = null;
        if ($table->getIdMethod() === IdMethod::NATIVE) {
Severity: Minor
Found in src/Propel/Generator/Platform/DefaultPlatform.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 getSequenceName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSequenceName(Table $table): string
    {
        $result = null;
        if ($table->getIdMethod() == IdMethod::NATIVE) {
            $idMethodParams = $table->getIdMethodParameters();
Severity: Minor
Found in src/Propel/Generator/Platform/PgsqlPlatform.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 generateScopePhp has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function generateScopePhp(): array
    {
        $methodSignature = '';
        $paramsDoc = '';
        $buildScope = '';
Severity: Minor
Found in src/Propel/Generator/Behavior/Sortable/SortableBehavior.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 moveI18nColumns has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function moveI18nColumns(): void
    {
        $table = $this->getTable();
        $i18nTable = $this->i18nTable;

Severity: Minor
Found in src/Propel/Generator/Behavior/I18n/I18nBehavior.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 getTemplatePath has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getTemplatePath(string $path): string
    {
        $srcPos = strrpos($path, DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);
        if ($srcPos === false) {
            // BC shim for old template paths
Severity: Minor
Found in src/Propel/Common/Util/PathTrait.php - About 1 hr to fix

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

      Method parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function parse(Database $database, array $additionalTables = []): int
          {
              $tables = [];
              /** @var \PDOStatement $stmt */
              $stmt = $this->dbh->query("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'");
      Severity: Minor
      Found in src/Propel/Generator/Reverse/OracleSchemaParser.php - About 1 hr to fix

        Method addRefFKRemove has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function addRefFKRemove(string &$script, ForeignKey $refFK): void
            {
                $tblFK = $refFK->getTable();
        
                $className = $this->getClassNameFromTable($refFK->getTable());
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

          Method getConfiguredSchemaParser has 35 lines of code (exceeds 25 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

            Method getDropTableDDL has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getDropTableDDL(Table $table): string
                {
                    $ret = '';
                    foreach ($table->getForeignKeys() as $fk) {
                        $ret .= "
            Severity: Minor
            Found in src/Propel/Generator/Platform/MssqlPlatform.php - About 1 hr to fix

              Method appendForeignKeyNode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function appendForeignKeyNode(ForeignKey $foreignKey, DOMNode $parentNode): void
                  {
                      /** @var \DOMElement $foreignKeyNode */
                      $foreignKeyNode = $parentNode->appendChild($this->document->createElement('foreign-key'));
                      $foreignKeyNode->setAttribute('foreignTable', $foreignKey->getForeignTableCommonName());
              Severity: Minor
              Found in src/Propel/Generator/Schema/Dumper/XmlDumper.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 generateScopePhp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function generateScopePhp(): array
                      {
                          $methodSignature = '';
                          $paramsDoc = '';
                          $buildScope = '';
                  Severity: Minor
                  Found in src/Propel/Generator/Behavior/Sortable/SortableBehavior.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language