owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

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

        public function upsert($table, $input, $compare) {
            $this->conn->beginTransaction();
            $done = false;
    
            if (empty($compare)) {
    Severity: Major
    Found in lib/private/DB/Adapter.php - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              fileActions.registerAction({
                  name: 'Accept',
                  type: OCA.Files.FileActions.TYPE_INLINE,
                  displayName: t('files_sharing', 'Accept Share'),
                  mime: 'all',
      Severity: Major
      Found in apps/files_sharing/js/app.js and 1 other location - About 2 hrs to fix
      apps/files_sharing/js/app.js on lines 276..286

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              fileActions.registerAction({
                  name: 'Reject',
                  type: OCA.Files.FileActions.TYPE_INLINE,
                  displayName: t('files_sharing', 'Decline Share'),
                  iconClass: 'icon-close',
      Severity: Major
      Found in apps/files_sharing/js/app.js and 1 other location - About 2 hrs to fix
      apps/files_sharing/js/app.js on lines 265..275

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 94.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function registerDefaultActions has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              registerDefaultActions: function (excludeActions) {
                  excludeActions = excludeActions || [];
      
                  var self = this;
                  var defaultActions = [
      Severity: Major
      Found in apps/files/js/fileactions.js - About 2 hrs to fix

        Function _initXHRData has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _initXHRData: function (options) {
                    var that = this,
                        formData,
                        file = options.files[0],
                        // Ignore non-multipart setting if not supported:
        Severity: Major
        Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

          Method sendInternalShareMail has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function sendInternalShareMail($sender, $node, $shareType, $recipientList): array {
                  if ($this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no') !== 'yes') {
                      $message_t = $this->l->t('Internal mail notification for shared files is not allowed');
                      throw new GenericShareException($message_t, $message_t, 403);
                  }
          Severity: Major
          Found in lib/private/Share/MailNotifications.php - About 2 hrs to fix

            Method getItemSharedWithUser has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null, $shareType = null) {
                    $shares = [];
                    $fileDependent = false;
            
                    $where = 'WHERE';
            Severity: Major
            Found in lib/private/Share/Share.php - About 2 hrs to fix

              Method mergeResponses has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function mergeResponses($responses) {
                      // Sort into shipped and third-party
                      $shipped = [
                          'succeeded' => [],
                          'failed' => [],
              Severity: Major
              Found in lib/private/legacy/api.php - About 2 hrs to fix

                Function getPermissionsFromRequest has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getPermissionsFromRequest() {
                        // int-based permissions are set -> use them
                        $permissions = $this->request->getParam('permissions', null);
                        if ($permissions !== null) {
                            return $permissions;
                Severity: Minor
                Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 2 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 move2trash has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function move2trash($file_path) {
                        // get the user for which the filesystem is setup
                        $root = Filesystem::getRoot();
                        list(, $user) = \explode('/', $root);
                        list($owner, $ownerPath) = self::getUidAndFilename($file_path);
                Severity: Minor
                Found in apps/files_trashbin/lib/Trashbin.php - About 2 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 xmlDeserialize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function xmlDeserialize(Reader $reader) {
                        $elems = (array)$reader->parseInnerTree([
                            '{DAV:}prop' => KeyValue::class,
                            '{http://owncloud.org/ns}filter-rules' => Base::class,
                            '{http://owncloud.org/ns}search' => KeyValue::class,
                Severity: Minor
                Found in apps/dav/lib/Files/Xml/FilterRequest.php - About 2 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 buildPolicy has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function buildPolicy() {
                        $policy = "default-src 'none';manifest-src 'self';";
                
                        if (!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) {
                            $policy .= 'script-src ';
                Severity: Minor
                Found in lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php - About 2 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 buildParts has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function buildParts(array $data) {
                        $fields = [
                            'path', 'parent', 'name', 'mimetype', 'size', 'mtime', 'storage_mtime', 'encrypted',
                            'etag', 'permissions', 'checksum'];
                
                
                Severity: Minor
                Found in lib/private/Files/Cache/Cache.php - About 2 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 doAppUpgrade has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function doAppUpgrade() {
                        $apps = \OC_App::getEnabledApps();
                        $priorityTypes = ['authentication', 'filesystem', 'logging'];
                        $pseudoOtherType = 'other';
                        $stacks = [$pseudoOtherType => []];
                Severity: Minor
                Found in lib/private/Updater.php - About 2 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 handleChildren has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function handleChildren($path, $recursive, $reuse, $folderId, $lock, &$size) {
                        // we put this in it's own function so it cleans up the memory before we start recursing
                        $existingChildren = $this->getExistingChildren($folderId);
                        $newChildren = $this->getNewChildren($path);
                
                
                Severity: Minor
                Found in lib/private/Files/Cache/Scanner.php - About 2 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 createSelectStatement has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function createSelectStatement($format, $fileDependent, $uidOwner = null) {
                        $select = '*';
                        if ($format == self::FORMAT_STATUSES) {
                            if ($fileDependent) {
                                $select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, '
                Severity: Minor
                Found in lib/private/Share/Share.php - About 2 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 afterException has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function afterException($controller, $methodName, \Exception $exception) {
                        $headers = [];
                        if ($controller instanceof OCSController) {
                            if ($this->request->getHeader('OC-RequestAppPassword') === 'true'
                                    && ($exception instanceof NotLoggedInException || $exception instanceof LoginException)) {
                Severity: Minor
                Found in lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php - About 2 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 execute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function execute(InputInterface $input, OutputInterface $output): int {
                        $uid = $input->getArgument('uid');
                        if ($this->userManager->userExists($uid)) {
                            $output->writeln('<error>The user "' . $uid . '" already exists.</error>');
                            return 1;
                Severity: Minor
                Found in core/Command/User/Add.php - About 2 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

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                    public function __construct(
                        $appName,
                        IRequest $request,
                        IJobList $jobList,
                        ISecureRandom $secureRandom,
                Severity: Major
                Found in apps/updatenotification/lib/Controller/AdminController.php and 4 other locations - About 2 hrs to fix
                apps/federatedfilesharing/lib/Controller/OcmController.php on lines 96..116
                apps/files_sharing/lib/Controller/NotificationController.php on lines 54..73
                core/Controller/AvatarController.php on lines 85..105
                core/Controller/LoginController.php on lines 76..95

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 140.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language