owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

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

                IUserSession $userSession = null,
                IAppConfig $appConfig = null,
                IGroupManager $groupManager = null,
                ICacheFactory $memCacheFactory,
                EventDispatcherInterface $dispatcher,
        Severity: Minor
        Found in lib/private/App/AppManager.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for ($k = 8 - $bit; $k >= $limit; $k -= $bit) {
                                      $index = \imagecolorat($im, $i, $j);
                                      $bin |= $index << $k;
                                      $i++;
                                  }
          Severity: Major
          Found in lib/private/legacy/image.php - About 45 mins to fix

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

                public function __construct(IConfig $config, ILogger $logger, IL10N $l10n, View $rootView, Util $util, ArrayCache $arrayCache) {
            Severity: Minor
            Found in lib/private/Encryption/Manager.php - About 45 mins to fix

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

                  public static function respond($result, $format='xml') {
                      $request = \OC::$server->getRequest();
              
                      // Send 401 headers if unauthorised
                      if ($result->getStatusCode() === API::RESPOND_UNAUTHORISED) {
              Severity: Minor
              Found in lib/private/legacy/api.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 checkDatabaseVersion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function checkDatabaseVersion() {
                      $l = \OC::$server->getL10N('lib');
                      $errors = [];
                      $dbType = \OC::$server->getSystemConfig()->getValue('dbtype', 'sqlite');
                      if ($dbType === 'pgsql') {
              Severity: Minor
              Found in lib/private/legacy/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

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

                  public function generateToken($token, $uid, $loginName, $password, $name, $type = IToken::TEMPORARY_TOKEN) {
              Severity: Minor
              Found in lib/private/Authentication/Token/DefaultTokenProvider.php - About 45 mins to fix

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

                        IConfig $config,
                        IniGetWrapper $iniWrapper,
                        IL10N $l10n,
                        \OC_Defaults $defaults,
                        ILogger $logger,
                Severity: Minor
                Found in lib/private/Setup.php - About 45 mins to fix

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

                      public function generateToken($token, $uid, $loginName, $password, $name, $type = IToken::TEMPORARY_TOKEN);
                  Severity: Minor
                  Found in lib/private/Authentication/Token/IProvider.php - About 45 mins to fix

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

                        public function executeStep($version) {
                            $this->logger->debug("Migrations: starting $version from app {$this->appName}", ['app' => 'core']);
                            $instance = $this->createInstance($version);
                            if ($instance instanceof ISimpleMigration) {
                                $instance->run($this->output);
                    Severity: Minor
                    Found in lib/private/DB/MigrationService.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