owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function readfilePart has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function readfilePart($path, $from, $to) {
        $this->assertPathLength($path);
        @\ob_end_clean();
        $handle = $this->fopen($path, 'rb');
        if ($handle) {
Severity: Minor
Found in lib/private/Files/View.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 addLocalFolder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function addLocalFolder($path, $target) {
        $dh = $this->opendir($path);
        if (\is_resource($dh)) {
            while (($file = \readdir($dh)) !== false) {
                if (!Filesystem::isIgnoredDir($file)) {
Severity: Minor
Found in lib/private/Files/Storage/Common.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 renameFromStorage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
        if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
            return;
        }

Severity: Minor
Found in lib/private/Files/Cache/Updater.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 __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $parameters,
        IManager $encryptionManager = null,
        Util $util = null,
        ILogger $logger = null,
        IFile $fileHelper = null,
Severity: Major
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 1 hr to fix

    Function initMountPoints has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function initMountPoints($user = '', $fullInit = true) {
            if ($user == '') {
                $user = \OC_User::getUser();
            }
            if ($user === null || $user === false || $user === '') {
    Severity: Minor
    Found in lib/private/Files/Filesystem.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct($storage, $isAvailable = true) {
            if ($storage instanceof \OC\Files\Storage\Storage) {
                $this->storageId = $storage->getId();
            } else {
                $this->storageId = $storage;
    Severity: Minor
    Found in lib/private/Files/Cache/Storage.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 setupDatabase has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setupDatabase($username) {
            $e_host = \addslashes($this->dbHost);
            $e_user = \addslashes($this->dbUser);
            $e_password = \addslashes($this->dbPassword);
    
    
    Severity: Minor
    Found in lib/private/Setup/PostgreSQL.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 getNewChildren has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getNewChildren($folder) {
            $children = [];
            if ($dh = $this->storage->opendir($folder)) {
                if (\is_resource($dh)) {
                    while (($file = \readdir($dh)) !== false) {
    Severity: Minor
    Found in lib/private/Files/Cache/Scanner.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 publishActivity has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority) {
    Severity: Major
    Found in lib/private/Activity/Manager.php - About 1 hr to fix

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

              IManager $shareManager,
              IL10N $l10n,
              IMailer $mailer,
              IConfig $config,
              ILogger $logger,
      Severity: Major
      Found in lib/private/Share/MailNotifications.php - About 1 hr to fix

        Function getTempBaseDir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getTempBaseDir(): string {
                if ($this->tmpBaseDir) {
                    return $this->tmpBaseDir;
                }
        
        
        Severity: Minor
        Found in lib/private/TempManager.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 publish has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function publish(IEvent $event) {
                if (!$event->getApp()) {
                    throw new \BadMethodCallException('App not set', 10);
                }
                if (!$event->getType()) {
        Severity: Minor
        Found in lib/private/Activity/Manager.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 addStep has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addStep($repairStep) {
                if (\is_string($repairStep)) {
                    try {
                        $s = \OC::$server->query($repairStep);
                    } catch (QueryException $e) {
        Severity: Minor
        Found in lib/private/Repair.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 populateStorageConfigWithLegacyOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function populateStorageConfigWithLegacyOptions(
                &$storageConfig,
                $mountType,
                $applicable,
                $storageOptions
        Severity: Minor
        Found in lib/private/Files/External/Service/LegacyStoragesService.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 getBackendStatus has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) {
                if (self::$skipTest) {
                    return StorageNotAvailableException::STATUS_SUCCESS;
                }
                $user = \OC::$server->getUserSession()->getUser();
        Severity: Minor
        Found in lib/private/Files/External/LegacyUtil.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 put has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $itemType,
                $itemSource,
                $shareType,
                $shareWith,
                $uidOwner,
        Severity: Major
        Found in lib/private/Share/Share.php - About 1 hr to fix

          Function readData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              private function readData() {
                  // Default config should always get loaded
                  $configFiles = [$this->configFilePath];
          
                  // Add all files in the config dir ending with the same file name
          Severity: Minor
          Found in lib/private/Config.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 updateForRecipient has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function updateForRecipient(\OCP\Share\IShare $share, $recipient) {
                  if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                      if ($share->getSharedWith() !== $recipient) {
                          throw new ProviderException('Recipient does not match');
                      }
          Severity: Minor
          Found in lib/private/Share20/DefaultShareProvider.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 isCached has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function isCached() {
                  $fileId = $this->getFile()->getId();
                  if ($fileId === null) {
                      return false;
                  }
          Severity: Minor
          Found in lib/private/Preview.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 isAppDirWritable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function isAppDirWritable($appId) {
                  $path = self::getAppPath($appId);
                  // Check if the parent directory is marked as writable in config.php
                  if ($path !== false) {
                      $appDir = \substr($path, 0, -\strlen("/$appId"));
          Severity: Minor
          Found in lib/private/legacy/app.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

          Severity
          Category
          Status
          Source
          Language