keboola/juicer

View on GitHub

Showing 33 of 60 total issues

Function __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(ScrollerInterface $scroller, array $config, LoggerInterface $logger)
    {
        parent::__construct($scroller, $logger);
        if (!empty($config['forceStop'])) {
            if (!empty($config['forceStop']['pages'])) {
Severity: Minor
Found in src/Pagination/Decorator/ForceStopScrollerDecorator.php - About 35 mins 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 mergeResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function mergeResults(array $results, array $files): array
    {
        foreach ($files as $name => $file) {
            if (array_key_exists($name, $results)) {
                $this->logger->debug("Merging results for '{$name}'.");
Severity: Minor
Found in src/Parser/JsonMap.php - About 35 mins 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 getNextRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNextRequest(RestClient $client, JobConfig $jobConfig, $response, array $data): ?RestRequest
    {
        $nextUrl = getDataFromPath($this->urlParam, $response, $this->delimiter);

        if (empty($nextUrl)) {
Severity: Minor
Found in src/Pagination/ResponseUrlScroller.php - About 35 mins 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

Avoid too many return statements within this method.
Open

                return new PageScroller($config, $logger);
Severity: Major
Found in src/Pagination/ScrollerFactory.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return new ZendeskResponseUrlScroller($config, $logger);
    Severity: Major
    Found in src/Pagination/ScrollerFactory.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return new CursorScroller($config, $logger);
      Severity: Major
      Found in src/Pagination/ScrollerFactory.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return new MultipleScroller($config, $logger);
        Severity: Major
        Found in src/Pagination/ScrollerFactory.php - About 30 mins to fix

          Function __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct(array $config, LoggerInterface $logger)
              {
                  if (empty($config['responseParam'])) {
                      throw new UserException("Missing required 'pagination.responseParam' parameter.");
                  }
          Severity: Minor
          Found in src/Pagination/ResponseParamScroller.php - About 25 mins 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 getNextRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getNextRequest(RestClient $client, JobConfig $jobConfig, $response, array $data): ?RestRequest
              {
                  $nextParam = getDataFromPath($this->responseParam, $response, '.');
                  if (empty($nextParam)) {
                      $this->logger->info('No more pages found, stopping pagination.');
          Severity: Minor
          Found in src/Pagination/ResponseParamScroller.php - About 25 mins 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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function create(RestRequest $restRequest): RequestInterface
              {
                  $body = null;
                  $headers = $restRequest->getHeaders();
                  switch ($restRequest->getMethod()) {
          Severity: Minor
          Found in src/Client/GuzzleRequestFactory.php - About 25 mins 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 getScrollerForJob has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getScrollerForJob(JobConfig $jobConfig): ScrollerInterface
              {
                  if (empty($jobConfig->getConfig()['scroller'])) {
                      if (empty($this->defaultScroller)) {
                          return new NoScroller();
          Severity: Minor
          Found in src/Pagination/MultipleScroller.php - About 25 mins 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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct(array $config, LoggerInterface $logger)
              {
                  if (empty($config['limit'])) {
                      throw new UserException("Missing 'pagination.limit' attribute required for offset pagination");
                  }
          Severity: Minor
          Found in src/Pagination/OffsetScroller.php - About 25 mins 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 getNextRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getNextRequest(RestClient $client, JobConfig $jobConfig, $response, array $data): ?RestRequest
              {
                  $nextUrl = getDataFromPath($this->urlParam, $response, '.');
          
                  if (empty($nextUrl)) {
          Severity: Minor
          Found in src/Pagination/ZendeskResponseUrlScroller.php - About 25 mins 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