owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function unscalable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function unscalable($x, $y) {
        $maxX = $this->getMaxX();
        $maxY = $this->getMaxY();
        $scalingUp = $this->getScalingUp();
        $maxScaleFactor = $this->getMaxScaleFactor();
Severity: Minor
Found in lib/private/Preview.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 getDescription has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDescription($errorCode, $errorObject) {
        switch ($errorCode) {
            case CodeChecker::STATIC_CALL_NOT_ALLOWED:
                $functions = $this->getLocalFunctions();
                $functions = \array_change_key_case($functions, CASE_LOWER);
Severity: Minor
Found in lib/private/App/CodeChecker/AbstractCheck.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 scale has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function scale($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) {
        $scalingUp = $this->getScalingUp();
        $maxScaleFactor = $this->getMaxScaleFactor();

        $factorX = $askedWidth / $previewWidth;
Severity: Minor
Found in lib/private/Preview.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 listNotifiers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function listNotifiers() {
        if (!empty($this->notifiersInfo)) {
            return $this->notifiersInfo;
        }

Severity: Minor
Found in lib/private/Notification/Manager.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 prepare has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepare(INotification $notification, $languageCode) {
        $notifiers = $this->getNotifiers();

        foreach ($notifiers as $notifier) {
            try {
Severity: Minor
Found in lib/private/Notification/Manager.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

Avoid deeply nested control flow statements.
Open

                        if (!$officeFound) {
                            $whichOpenOffice = \shell_exec('command -v openoffice');
                            $officeFound = !empty($whichOpenOffice);
                        }
Severity: Major
Found in lib/private/PreviewManager.php - About 45 mins to fix

    Function getInsecureServerHost has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getInsecureServerHost() {
            $host = 'localhost';
            if (isset($this->server['HTTP_X_FORWARDED_HOST'])) {
                if (\strpos($this->server['HTTP_X_FORWARDED_HOST'], ',') !== false) {
                    $parts = \explode(',', $this->server['HTTP_X_FORWARDED_HOST']);
    Severity: Minor
    Found in lib/private/AppFramework/Http/Request.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

    Avoid deeply nested control flow statements.
    Open

                                if ($sameNum != 0) {
                                    $bmpData .= \chr($sameNum) . \chr($lastIndex);
                                }
    Severity: Major
    Found in lib/private/legacy/image.php - About 45 mins to fix

      Function getDisplayName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getDisplayName($uid = null) {
              if ($uid) {
                  $user = \OC::$server->getUserManager()->get($uid);
                  if ($user) {
                      return $user->getDisplayName();
      Severity: Minor
      Found in lib/private/legacy/user.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 getAppInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAppInfo($appId) {
              if (!\is_string($appId) || $appId === '') {
                  return null; // TODO explode?
              }
      
      
      Severity: Minor
      Found in lib/private/App/AppManager.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

      Avoid deeply nested control flow statements.
      Open

                                      if (($enabled || \in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps()))
                                          && \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') {
                                          $shippedApps[] = $filename;
                                      }
      Severity: Major
      Found in lib/private/Installer.php - About 45 mins to fix

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

                View $view,
                Util $util,
                Mount\Manager $mountManager,
                Manager $encryptionManager,
                File $file,
        Severity: Minor
        Found in lib/private/Encryption/Update.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (\is_file($extractDir.'/'.$folder.'/appinfo/info.xml')) {
                                      $extractDir.='/'.$folder;
                                  }
          Severity: Major
          Found in lib/private/Installer.php - About 45 mins to fix

            Function sendHeaders has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function sendHeaders($filename, $name, array $rangeArray) {
                    OC_Response::setContentDispositionHeader($name, 'attachment');
                    \header('Content-Transfer-Encoding: binary', true);
                    OC_Response::disableCaching();
                    $fileSize = \OC\Files\Filesystem::filesize($filename);
            Severity: Minor
            Found in lib/private/legacy/files.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 enable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function enable($app, $groups = null) {
                    self::$enabledAppsCache = []; // flush
            
                    // check for required dependencies
                    $config = \OC::$server->getConfig();
            Severity: Minor
            Found in lib/private/legacy/app.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 getAppInfoByPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getAppInfoByPath($path, $etag = null) {
                    $file = \realpath($path);
            
                    // check the cache
                    $data = $this->appInfo->get($file);
            Severity: Minor
            Found in lib/private/App/AppManager.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 getStorage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getStorage($appId) {
                    if (OC_App::isEnabled($appId)) { //sanity check
                        if (OC_User::isLoggedIn()) {
                            $view = new \OC\Files\View('/' . OC_User::getUser());
                            if (!$view->file_exists($appId)) {
            Severity: Minor
            Found in lib/private/legacy/app.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 installShippedApp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function installShippedApp($app) {
                    \OC::$server->getLogger()->info('Attempting to install shipped app: '.$app);
            
                    $info = OC_App::getAppInfo($app);
                    if ($info === null) {
            Severity: Minor
            Found in lib/private/Installer.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 useBackend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function useBackend($backend = 'database') {
                    if ($backend instanceof \OCP\UserInterface) {
                        self::$_usedBackends[\get_class($backend)] = $backend;
                        \OC::$server->getUserManager()->registerBackend($backend);
                    } else {
            Severity: Minor
            Found in lib/private/legacy/user.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 isExcluded has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function isExcluded($path) {
                    $normalizedPath = Filesystem::normalizePath($path);
                    $root = \explode('/', $normalizedPath, 4);
                    if (\count($root) > 1) {
                        // detect alternative key storage root
            Severity: Minor
            Found in lib/private/Encryption/Util.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

            Severity
            Category
            Status
            Source
            Language