owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public function getQueryForFilter($filter) {
        $user = $this->activityManager->getCurrentUserId();
        // Display actions from all files
        if ($filter === self::FILTER_FILES) {
            return ['`app` = ?', [self::APP_FILES]];
Severity: Minor
Found in apps/files/lib/Activity.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/public/Activity/IManager.php - About 1 hr to fix

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

        public static function initSession() {
            // Let the session name be changed in the initSession Hook
            $sessionName = OC_Util::getInstanceId();
    
            try {
    Severity: Minor
    Found in lib/kernel.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 index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function index($dir = '', $view = '', $fileid = null, $details = null) {
            $fileNotFound = false;
            if ($fileid !== null) {
                try {
                    return $this->showFile($fileid, $details);
    Severity: Minor
    Found in apps/files/lib/Controller/ViewController.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 showFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function showFile($fileId, $details = null) {
            $uid = $this->userSession->getUser()->getUID();
            $baseFolder = $this->rootFolder->get($uid . '/files/');
            '@phan-var \OCP\Files\Folder $baseFolder';
            $files = $baseFolder->getById($fileId);
    Severity: Minor
    Found in apps/files/lib/Controller/ViewController.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 addRecursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addRecursive($path, $source) {
            $dh = \opendir($source);
            if (\is_resource($dh)) {
                $this->addFolder($path);
                while (($file = \readdir($dh)) !== false) {
    Severity: Minor
    Found in lib/private/Archive/Archive.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 stream_open has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function stream_open($path, $mode, $options, &$opened_path) {
            switch ($mode[0]) {
                case 'r':
                    if (!isset(self::$data[$path])) {
                        return false;
    Severity: Minor
    Found in lib/private/Files/Stream/StaticStream.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 fileExists has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fileExists($path) {
            $files = $this->getFiles();
            if ((\array_search($path, $files) !== false) or (\array_search($path . '/', $files) !== false)) {
                return true;
            } else {
    Severity: Minor
    Found in lib/private/Archive/TAR.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 addUser has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

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

        protected function copyRecursive($source, $target) {
            $dh = $this->opendir($source);
            $result = true;
            while ($file = \readdir($dh)) {
                if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
    Severity: Minor
    Found in lib/private/Files/Storage/PolyFill/CopyDirectory.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 getFolder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFolder($path) {
            $files = $this->getFiles();
            $folderContent = [];
            $pathLength = \strlen($path);
            foreach ($files as $file) {
    Severity: Minor
    Found in lib/private/Archive/TAR.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 rmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function rmdir($path) {
            if (!$this->isDeletable($path)) {
                return false;
            }
            try {
    Severity: Minor
    Found in lib/private/Files/Storage/Local.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 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

      Severity
      Category
      Status
      Source
      Language