keboola/gooddata-php-client

View on GitHub

Showing 58 of 60 total issues

File Client.php has 435 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @package gooddata-php-client
 * @copyright Keboola
 * @author Jakub Matejka <jakub@keboola.com>
Severity: Minor
Found in src/Client.php - About 6 hrs to fix

    Function diff has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        public function diff($pid, $model)
        {
            $uri = "/gdc/projects/$pid/model/diff?includeDeprecated=true&includeGrain=true";
            $result = $this->client->post($uri, ['diffRequest' => ['targetModel' => $model]]);
    
    
    Severity: Minor
    Found in src/ProjectModel.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 normalizeModel has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        public function normalizeModel($model)
        {
            foreach ($model['projectModel']['datasets'] as &$d) {
                if (isset($d['dataset']['anchor']['attribute']['labels'])) {
                    foreach ($d['dataset']['anchor']['attribute']['labels'] as &$l) {
    Severity: Minor
    Found in src/ProjectModel.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 unaccent has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function unaccent($string)
        {
            if (!preg_match('/[\x80-\xff]/', $string)) {
                return $string;
            }
    Severity: Major
    Found in src/Utility.php - About 4 hrs to fix

      Method getDataLoadManifest has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getDataLoadManifest(
              $identifier,
              array $columns,
              $incrementalLoad = false
          ) {
      Severity: Major
      Found in src/Datasets.php - About 4 hrs to fix

        Client has 35 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Client
        {
            /**
             * Number of retries for one API call
             */
        Severity: Minor
        Found in src/Client.php - About 4 hrs to fix

          Function getDataLoadManifest has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getDataLoadManifest(
                  $identifier,
                  array $columns,
                  $incrementalLoad = false
              ) {
          Severity: Minor
          Found in src/Datasets.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

          File Projects.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * @package gooddata-php-client
           * @copyright Keboola
           * @author Jakub Matejka <jakub@keboola.com>
          Severity: Minor
          Found in src/Projects.php - About 2 hrs to fix

            Function request has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                public function request($method, $uri, $params = [], $retries = 5)
                {
                    $startTime = time();
            
                    $options = $this->guzzleOptions;
            Severity: Minor
            Found in src/Client.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 pollEtlTask has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                private function pollEtlTask($uri)
                {
                    $try = 1;
                    do {
                        sleep(min(pow(2, $try), rand(15, 20)));
            Severity: Minor
            Found in src/Datasets.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 diff has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function diff($pid, $model)
                {
                    $uri = "/gdc/projects/$pid/model/diff?includeDeprecated=true&includeGrain=true";
                    $result = $this->client->post($uri, ['diffRequest' => ['targetModel' => $model]]);
            
            
            Severity: Major
            Found in src/ProjectModel.php - About 2 hrs to fix

              Function getToFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getToFile($uri, $filename, $retries = 20)
                  {
                      $this->refreshToken();
                      $startTime = time();
              
              
              Severity: Minor
              Found in src/Client.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 update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function update($pid, $model, $dryRun = false, $multivalueAttributes = [])
                  {
                      $model = $this->normalizeModel($model);
              
                      $update = $this->diff($pid, $model);
              Severity: Minor
              Found in src/ProjectModel.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 seemsUtf8 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function seemsUtf8($string)
                  {
                      for ($i = 0; $i < strlen($string); $i++) {
                          if (ord($string[$i]) < 0x80) {
                              continue;   # 0bbbbbbb
              Severity: Minor
              Found in src/Utility.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 saveLogs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function saveLogs($folderName, $logFile)
                  {
                      $errors = [];
              
                      $uploadFile = "$folderName/upload_status.json";
              Severity: Minor
              Found in src/WebDav.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 Datasets.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * @package gooddata-php-client
               * @copyright Keboola
               * @author Jakub Matejka <jakub@keboola.com>
              Severity: Minor
              Found in src/Datasets.php - About 2 hrs to fix

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

                    public function getToFile($uri, $filename, $retries = 20)
                    {
                        $this->refreshToken();
                        $startTime = time();
                
                
                Severity: Minor
                Found in src/Client.php - About 1 hr to fix

                  Method __construct has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct($username, $password, $url = '')
                      {
                          $this->username = $username;
                          $this->password = $password;
                  
                  
                  Severity: Minor
                  Found in src/WebDav.php - About 1 hr to fix

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

                        public function inviteUser($pid, $email, $role = Projects::ROLE_ADMIN, $filters = [])
                        {
                            $projectRoleUri = $this->getRoleUri($pid, $role);
                    
                            try {
                    Severity: Minor
                    Found in src/Projects.php - About 1 hr to fix

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

                          public static function parseMessage($message)
                          {
                              if (isset($message['message'])) {
                                  if (isset($message['parameters']) && count($message['parameters'])) {
                                      $message = vsprintf($message['message'], $message['parameters']);
                      Severity: Minor
                      Found in src/Exception.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

                      Severity
                      Category
                      Status
                      Source
                      Language