owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $confirmed = $input->getOption('continue');
        if (($confirmed !== 'yes') && ($confirmed !== 'no')) {
            $output->writeln('Continue can accept either yes or no');
            return 2;
Severity: Minor
Found in core/Command/Encryption/DecryptAll.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 validateArray has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateArray($array) {
        $arrayKeys = \array_keys($array);
        $additionalKeys = \array_diff($arrayKeys, $this->validRootKeys);
        $commonKeys = \array_intersect($arrayKeys, $this->validRootKeys);
        if (!empty($additionalKeys)) {
Severity: Minor
Found in core/Command/Config/Import.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 execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        if ($input->getOption('list')) {
            $backends = $this->userManager->getBackends();
            foreach ($backends as $backend) {
                $output->writeln(\get_class($backend));
Severity: Minor
Found in core/Command/User/SyncBackend.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 sortGroups has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        sortGroups: function () {
            var lis = this.$userGroupList.find('.isgroup').get();

            lis.sort(function (a, b) {
                // "Everyone" always at the top
Severity: Minor
Found in settings/js/users/groups.js - About 1 hr to fix

    Function createFile has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            createFile: function(name) {
                var self = this;
                var deferred = $.Deferred();
                var promise = deferred.promise();
    
    
    Severity: Minor
    Found in apps/files/js/filelist.js - About 1 hr to fix

      Function add has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              add: function(fileData, options) {
                  var index = -1;
                  var $tr;
                  var $rows;
                  var $insertionPoint;
      Severity: Minor
      Found in apps/files/js/filelist.js - About 1 hr to fix

        Function bindKeyboardShortcuts has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            Files.bindKeyboardShortcuts = function(document, $) {
                $(document).keydown(function(event) { //check for modifier keys
                    if(!$(event.target).is('body')) {
                        return;
                    }
        Severity: Minor
        Found in apps/files/js/keyboardshortcuts.js - About 1 hr to fix

          Function callMethod has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function callMethod(client, options, model, headers) {
                  var data = options.data;
                  if (_.isObject(data)) {
                      headers['Content-Type'] = 'application/json';
                      data = JSON.stringify(data);
          Severity: Minor
          Found in core/js/oc-backbone-webdav.js - About 1 hr to fix

            Method testRemoteUrl has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testRemoteUrl(IClientService $clientService, string $remote) {
                    $parsed_host = parse_url($remote, PHP_URL_HOST);
                    $parsed_port = parse_url($remote, PHP_URL_PORT);
                    if (\is_string($parsed_host)) {
                        $remote = $parsed_host;
            Severity: Minor
            Found in apps/files_sharing/lib/External/Manager.php - About 1 hr to fix

              Method registerListeners has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function registerListeners() {
                      $container = $this->getContainer();
                      $server = $container->getServer();
                      $eventDispatcher = $server->getEventDispatcher();
              
              
              Severity: Minor
              Found in apps/federatedfilesharing/lib/AppInfo/Application.php - About 1 hr to fix

                Method handleGetProperties has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handleGetProperties(
                        PropFind $propFind,
                        \Sabre\DAV\INode $node
                    ) {
                        if (!($node instanceof SystemTagNode) && !($node instanceof SystemTagMappingNode)) {
                Severity: Minor
                Found in apps/dav/lib/SystemTag/SystemTagPlugin.php - About 1 hr to fix

                  Method getACL has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getACL() {
                          $acl = [
                              [
                                  'privilege' => '{DAV:}all',
                                  'principal' => '{DAV:}owner',
                  Severity: Minor
                  Found in apps/dav/lib/Files/PublicFiles/SharedNodeTrait.php - About 1 hr to fix

                    Method searchEx has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function searchEx($addressBookId, $pattern, $searchProperties, $options, $limit = 100, $offset = 0) {
                            $query = $this->db->getQueryBuilder();
                            $cardIdSelect = $this->db->getQueryBuilder();
                            $cardIdSelect->selectDistinct('cp.cardid')->from($this->dbCardsPropertiesTable, 'cp');
                    
                    
                    Severity: Minor
                    Found in apps/dav/lib/CardDAV/CardDavBackend.php - About 1 hr to fix

                      Method configure has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function configure() {
                              $this
                                  ->setName('files_external:list')
                                  ->setDescription('List configured admin or personal mounts')
                                  ->addArgument(
                      Severity: Minor
                      Found in apps/files_external/lib/Command/ListCommand.php - About 1 hr to fix

                        Method updateCard has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function updateCard(VCard $vCard, IUser $user) {
                                $uid = $user->getUID();
                                $displayName = $user->getDisplayName();
                                $displayName = empty($displayName) ? $uid : $displayName;
                                $emailAddress = $user->getEMailAddress();
                        Severity: Minor
                        Found in apps/dav/lib/CardDAV/Converter.php - About 1 hr to fix

                          Method getAllVersions has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getAllVersions($uid) {
                                  $view = $this->getUserView($uid);
                                  $dirs = [self::VERSIONS_RELATIVE_PATH];
                                  $versions = [];
                          
                          
                          Severity: Minor
                          Found in apps/files_versions/lib/FileHelper.php - About 1 hr to fix

                            Method createSelectStatement has 39 lines of code (exceeds 25 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 1 hr to fix

                              Method downloadApp has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function downloadApp($data = []) {
                                      $l = \OC::$server->getL10N('lib');
                              
                                      if (!isset($data['source'])) {
                                          throw new \Exception($l->t("No source specified when installing app"));
                              Severity: Minor
                              Found in lib/private/Installer.php - About 1 hr to fix

                                Method getUsersForUserValue has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getUsersForUserValue($appName, $key, $value) {
                                        // TODO - FIXME
                                        $this->fixDIInit();
                                
                                        $queryBuilder = $this->connection->getQueryBuilder();
                                Severity: Minor
                                Found in lib/private/AllConfig.php - About 1 hr to fix

                                  Function displayStorageWarnings has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          displayStorageWarnings: function() {
                                              if (!OC.Notification.isHidden()) {
                                                  return;
                                              }
                                  
                                  
                                  Severity: Minor
                                  Found in apps/files/js/files.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language