owncloud/core

View on GitHub
lib/private/BackgroundJob/JobList.php

Summary

Maintainability
C
7 hrs
Test Coverage

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

<?php
/**
 * @author Joas Schilling <coding@schilljs.com>
 * @author Morris Jobke <hey@morrisjobke.de>
 * @author Robin Appelman <icewind@owncloud.com>
Severity: Minor
Found in lib/private/BackgroundJob/JobList.php - About 2 hrs to fix

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

        public function getNext() {
            $query = $this->connection->getQueryBuilder();
            $query->select('*')
                ->from('jobs')
                ->where($query->expr()->lte('reserved_at', $query->createNamedParameter($this->timeFactory->getTime() - 12 * 3600, IQueryBuilder::PARAM_INT)))
    Severity: Minor
    Found in lib/private/BackgroundJob/JobList.php - About 1 hr to fix

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

          public function listJobsIncludingInvalid(
              \Closure $validJobCallback,
              \Closure $invalidJobCallback
          ): void {
              $query = $this->connection->getQueryBuilder();
      Severity: Minor
      Found in lib/private/BackgroundJob/JobList.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 getNext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getNext() {
              $query = $this->connection->getQueryBuilder();
              $query->select('*')
                  ->from('jobs')
                  ->where($query->expr()->lte('reserved_at', $query->createNamedParameter($this->timeFactory->getTime() - 12 * 3600, IQueryBuilder::PARAM_INT)))
      Severity: Minor
      Found in lib/private/BackgroundJob/JobList.php - About 45 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 listJobs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function listJobs(\Closure $callback) {
              $query = $this->connection->getQueryBuilder();
              $query->select('*')
                  ->from('jobs');
              $result = $query->execute();
      Severity: Minor
      Found in lib/private/BackgroundJob/JobList.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 null;
      Severity: Major
      Found in lib/private/BackgroundJob/JobList.php - About 30 mins to fix

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

            public function add($job, $argument = null) {
                if (!$this->has($job, $argument)) {
                    if ($job instanceof IJob) {
                        $class = \get_class($job);
                    } else {
        Severity: Minor
        Found in lib/private/BackgroundJob/JobList.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

        There are no issues that match your filters.

        Category
        Status