keboola/php-datatypes

View on GitHub
src/Definition/Exasol.php

Summary

Maintainability
D
2 days
Test Coverage

Showing 18 of 18 total issues

File Exasol.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
 
declare(strict_types=1);
 
namespace Keboola\Datatype\Definition;
Severity: Minor
Found in src/Definition/Exasol.php - About 4 hrs to fix

    The class Exasol has an overall complexity of 92 which is very high. The configured complexity threshold is 50.
    Open

    class Exasol extends Common
    {
    public const METADATA_BACKEND = 'exasol';
    /* core types */
    public const TYPE_DECIMAL = 'DECIMAL'; // DECIMAL(p,s) = s ≤ p ≤ 36
    Severity: Minor
    Found in src/Definition/Exasol.php by phpmd

    Method validateLength has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    private function validateLength(string $type, $length = null): void
    {
    $valid = true;
     
    switch (strtoupper($type)) {
    Severity: Major
    Found in src/Definition/Exasol.php - About 2 hrs to fix

      Function validateLength has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      private function validateLength(string $type, $length = null): void
      {
      $valid = true;
       
      switch (strtoupper($type)) {
      Severity: Minor
      Found in src/Definition/Exasol.php - About 2 hrs to fix

      Method getBasetype has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function getBasetype(): string
      {
      switch (strtoupper($this->type)) {
      case self::TYPE_DECIMAL:
      case self::TYPE_DEC:
      Severity: Minor
      Found in src/Definition/Exasol.php - About 1 hr to fix

        Method getDefaultLength has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        private function getDefaultLength()
        {
        $out = null;
        switch (strtoupper($this->type)) {
        case self::TYPE_DECIMAL:
        Severity: Minor
        Found in src/Definition/Exasol.php - About 1 hr to fix

          Function getTypeOnlySQLDefinition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          public function getTypeOnlySQLDefinition(): string
          {
          $type = $this->getType();
          $definition = strtoupper($type);
          if (!in_array($definition, self::TYPES_WITHOUT_LENGTH)) {
          Severity: Minor
          Found in src/Definition/Exasol.php - About 45 mins to fix

          Function getBasetype has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          public function getBasetype(): string
          {
          switch (strtoupper($this->type)) {
          case self::TYPE_DECIMAL:
          case self::TYPE_DEC:
          Severity: Minor
          Found in src/Definition/Exasol.php - About 45 mins to fix

          Function getDefaultLength has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          private function getDefaultLength()
          {
          $out = null;
          switch (strtoupper($this->type)) {
          case self::TYPE_DECIMAL:
          Severity: Minor
          Found in src/Definition/Exasol.php - About 45 mins to fix

          Avoid too many return statements within this method.
          Open

          return self::TYPE_DECIMAL;
          Severity: Major
          Found in src/Definition/Exasol.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return self::TYPE_TIMESTAMP;
            Severity: Major
            Found in src/Definition/Exasol.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

              return self::TYPE_VARCHAR;
              Severity: Major
              Found in src/Definition/Exasol.php - About 30 mins to fix

                The method getBasetype() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
                Open

                public function getBasetype(): string
                {
                switch (strtoupper($this->type)) {
                case self::TYPE_DECIMAL:
                case self::TYPE_DEC:
                Severity: Minor
                Found in src/Definition/Exasol.php by phpmd

                The method validateLength() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
                Open

                private function validateLength(string $type, $length = null): void
                {
                $valid = true;
                 
                switch (strtoupper($type)) {
                Severity: Minor
                Found in src/Definition/Exasol.php by phpmd

                The method getDefaultLength() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10.
                Open

                private function getDefaultLength()
                {
                $out = null;
                switch (strtoupper($this->type)) {
                case self::TYPE_DECIMAL:
                Severity: Minor
                Found in src/Definition/Exasol.php by phpmd

                The method validateLength uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                } else {
                $valid = false;
                }
                Severity: Minor
                Found in src/Definition/Exasol.php by phpmd

                Avoid using static access to class 'Keboola\Datatype\Definition\BaseType' in method 'getTypeByBasetype'.
                Open

                if (!BaseType::isValid($basetype)) {
                Severity: Minor
                Found in src/Definition/Exasol.php by phpmd

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                public static function getTypeByBasetype(string $basetype): string
                {
                $basetype = strtoupper($basetype);
                 
                if (!BaseType::isValid($basetype)) {
                Severity: Major
                Found in src/Definition/Exasol.php and 2 other locations - About 4 hrs to fix
                src/Definition/Snowflake.php on lines 341..367
                src/Definition/Synapse.php on lines 277..303

                There are no issues that match your filters.

                Category
                Status