owncloud/core

View on GitHub
lib/private/IntegrityCheck/Checker.php

Summary

Maintainability
D
2 days
Test Coverage

File Checker.php has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Lukas Reschke <lukas@statuscode.ch>
 * @author Roeland Jago Douma <rullzer@owncloud.com>
 * @author Thomas Müller <thomas.mueller@tmit.eu>
Severity: Minor
Found in lib/private/IntegrityCheck/Checker.php - About 5 hrs to fix

    Function generateHashes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        private function generateHashes(
            \RecursiveIteratorIterator $iterator,
            $path
        ) {
            $hashes = [];
    Severity: Minor
    Found in lib/private/IntegrityCheck/Checker.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

    Function verify has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        private function verify($signaturePath, $basePath, $certificateCN, $force = false) {
            if (!$force && !$this->isCodeCheckEnforced()) {
                return [];
            }
    
    
    Severity: Minor
    Found in lib/private/IntegrityCheck/Checker.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

    Method verify has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function verify($signaturePath, $basePath, $certificateCN, $force = false) {
            if (!$force && !$this->isCodeCheckEnforced()) {
                return [];
            }
    
    
    Severity: Major
    Found in lib/private/IntegrityCheck/Checker.php - About 2 hrs to fix

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

      class Checker {
          public const CACHE_KEY = 'oc.integritycheck.checker';
          /** @var EnvironmentHelper */
          private $environmentHelper;
          /** @var AppLocator */
      Severity: Minor
      Found in lib/private/IntegrityCheck/Checker.php - About 2 hrs to fix

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

            private function generateHashes(
                \RecursiveIteratorIterator $iterator,
                $path
            ) {
                $hashes = [];
        Severity: Minor
        Found in lib/private/IntegrityCheck/Checker.php - About 1 hr to fix

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

              public function verifyAppSignature($appId, $path = '', $force = false) {
                  try {
                      if ($path === '') {
                          $path = $this->appLocator->getAppPath($appId);
                      }
          Severity: Minor
          Found in lib/private/IntegrityCheck/Checker.php - About 1 hr to fix

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

                    EnvironmentHelper $environmentHelper,
                    FileAccessHelper $fileAccessHelper,
                    AppLocator $appLocator,
                    IConfig $config = null,
                    ICacheFactory $cacheFactory,
            Severity: Major
            Found in lib/private/IntegrityCheck/Checker.php - About 50 mins to fix

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

                  public function runInstanceVerification() {
                      $this->cleanResults();
                      $this->verifyCoreSignature();
              
                      // FIXME: appManager === null means ownCloud is not installed. We check all apps in this case
              Severity: Minor
              Found in lib/private/IntegrityCheck/Checker.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 verifyAppSignature has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function verifyAppSignature($appId, $path = '', $force = false) {
                      try {
                          if ($path === '') {
                              $path = $this->appLocator->getAppPath($appId);
                          }
              Severity: Minor
              Found in lib/private/IntegrityCheck/Checker.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