pbek/ownbackup

View on GitHub

Showing 14 of 14 total issues

File backupservice.php has 431 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * ownCloud - nextbackup
 *
 * This file is licensed under the Affero General Public License version 3 or
Severity: Minor
Found in service/backupservice.php - About 6 hrs to fix

    BackupService has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BackupService {
    
        private $appName;
        private $odb;
        private $configService;
    Severity: Minor
    Found in service/backupservice.php - About 2 hrs to fix

      Method createDBBackup has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createDBBackup()
          {
              $timestamp = time();
      
              try
      Severity: Major
      Found in service/backupservice.php - About 2 hrs to fix

        Function createDBBackup has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createDBBackup()
            {
                $timestamp = time();
        
                try
        Severity: Minor
        Found in service/backupservice.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 doRestoreTable has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function doRestoreTable( $timestamp, $table )
            {
                $timestamp = (int) $timestamp;
        
                if ( $timestamp === 0 )
        Severity: Minor
        Found in service/backupservice.php - About 2 hrs to fix

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

              protected static function findIntervalTimestamps( array $timestamps, $interval, $keepAmount = null )
              {
                  if ( count( $timestamps ) === 0 ) {
                      return [];
                  }
          Severity: Minor
          Found in service/backupservice.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 recursivelyRemoveDir has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              private function recursivelyRemoveDir( $dir )
              {
                  $success = false;
                  if (is_dir($dir)) {
                      $objects = scandir($dir);
          Severity: Minor
          Found in service/backupservice.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 doRestoreTable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function doRestoreTable( $timestamp, $table )
              {
                  $timestamp = (int) $timestamp;
          
                  if ( $timestamp === 0 )
          Severity: Minor
          Found in service/backupservice.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

          Method findIntervalTimestamps has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function findIntervalTimestamps( array $timestamps, $interval, $keepAmount = null )
              {
                  if ( count( $timestamps ) === 0 ) {
                      return [];
                  }
          Severity: Minor
          Found in service/backupservice.php - About 1 hr to fix

            Function updateSelectorHashItems has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function updateSelectorHashItems( $selectBox, items, addEmptyOption, sort )
                {
                    if ( addEmptyOption == undefined )
                    {
                        addEmptyOption = false;
            Severity: Minor
            Found in js/script.js - About 1 hr to fix

              Function findIntervalTimestampsFallback has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected static function findIntervalTimestampsFallback( array $timestamps, $interval, $keepAmount = null )
                  {
                      if ( count( $timestamps ) === 0 ) {
                          return [];
                      }
              Severity: Minor
              Found in service/backupservice.php - About 55 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 fetchTablesFromBackupTimestamp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fetchTablesFromBackupTimestamp( $timestamp )
                  {
                      $timestamp = (int) $timestamp;
              
                      if ( $timestamp === 0 )
              Severity: Minor
              Found in service/backupservice.php - About 55 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 fetchBackupTimestamps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function fetchBackupTimestamps()
                  {
                      $backupBaseDir = $this->configService->getBackupBaseDirectory();
                      $timestampList = array();
              
              
              Severity: Minor
              Found in service/backupservice.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

              Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function __construct($appName, \OC_DB $odb, IDBConnection $db, ConfigService $configService, ILogger $logger, $userId){
              Severity: Minor
              Found in service/backupservice.php - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language