keboola/php-datatypes

View on GitHub

Showing 54 of 102 total issues

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

    private function validateLength(string $type, $length = null): void
    {
        $valid = true;
        switch (strtoupper($type)) {
            case 'CHAR':
Severity: Minor
Found in src/Definition/MySQL.php - About 1 day 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

File Teradata.php has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace Keboola\Datatype\Definition;
Severity: Major
Found in src/Definition/Teradata.php - About 1 day to fix

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

        private function validateLength(string $type, $length = null): void
        {
            $valid = true;
            switch (strtoupper($type)) {
                case self::TYPE_NUMBER:
    Severity: Minor
    Found in src/Definition/Snowflake.php - About 6 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 validateLength has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        private function validateLength(string $type, $length = null): void
        {
            $valid = true;
            switch (strtoupper($type)) {
                case 'DECIMAL':
    Severity: Minor
    Found in src/Definition/Redshift.php - About 6 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 validateLength has 124 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      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

        File Redshift.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          Method validateCompression has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function validateCompression(string $type, string $compression): void
              {
                  $valid = true;
                  $type = strtoupper($type);
                  switch (strtoupper($compression)) {
          Severity: Major
          Found in src/Definition/Redshift.php - About 3 hrs to fix

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

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

              File Snowflake.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

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

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

                  Method validateLength has 76 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/Teradata.php - About 3 hrs to fix

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

                        private function validateLength(string $type, $length = null): void
                        {
                            $valid = true;
                            switch (strtoupper($type)) {
                                case self::TYPE_FLOAT:
                    Severity: Minor
                    Found in src/Definition/Synapse.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 validateCompression has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function validateCompression(string $type, string $compression): void
                        {
                            $valid = true;
                            $type = strtoupper($type);
                            switch (strtoupper($compression)) {
                    Severity: Minor
                    Found in src/Definition/Redshift.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

                    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

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

                          private function getDefaultLength()
                          {
                              $out = null;
                              switch ($this->type) {
                                  // decimals
                      Severity: Major
                      Found in src/Definition/Teradata.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

                        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

                        File MySQL.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

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

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

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

                                public function getBasetype(): string
                                {
                                    switch (strtoupper($this->type)) {
                                        case self::TYPE_INT:
                                        case self::TYPE_INTEGER:
                            Severity: Minor
                            Found in src/Definition/Snowflake.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language