owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method getAllSharesBy has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares) {
        $shares = [];

        $qb = $this->dbConnection->getQueryBuilder();
        $qb->select('*')
Severity: Minor
Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 1 hr to fix

    Method buildOCSResponse has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function buildOCSResponse($format, $data) {
            if ($data instanceof Result) {
                $headers = $data->getHeaders();
                $d = $data->getData();
                $data = $data->getMeta();
    Severity: Minor
    Found in lib/public/AppFramework/OCSController.php - About 1 hr to fix

      Method crashLog has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function crashLog(\Throwable $ex): void {
              $crashDir = self::$SERVERROOT . '/data';
              if (self::$config) {
                  $dataDir = self::$config->getValue('datadirectory', self::$SERVERROOT . '/data');
                  $crashDir = self::$config->getValue('crashdirectory', $dataDir);
      Severity: Minor
      Found in lib/kernel.php - About 1 hr to fix

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

          Method populateStorageConfigWithLegacyOptions has 36 lines of code (exceeds 25 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

            Method checkLicenseFor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function checkLicenseFor(string $appid, array $options = []): bool {
                    $currentTime = $this->timeFactory->getTime();
            
                    $gracePeriod = $this->config->getAppValue('core', 'grace_period', null);
                    if ($gracePeriod === null) {
            Severity: Minor
            Found in lib/private/License/LicenseManager.php - About 1 hr to fix

              Method userDeleted has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function userDeleted($uid, $shareType) {
                      $qb = $this->dbConn->getQueryBuilder();
              
                      $qb->delete('share');
              
              
              Severity: Minor
              Found in lib/private/Share20/DefaultShareProvider.php - About 1 hr to fix

                Method getSharedWith has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) {
                        $provider = $this->factory->getProviderForType($shareType);
                
                        $shares = $provider->getSharedWith($userId, $shareType, $node, $limit, $offset);
                
                
                Severity: Minor
                Found in lib/private/Share20/Manager.php - About 1 hr to fix

                  Method __construct has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct(ICheck $list) {
                          $this->list = $list;
                  
                          $this->blackListedClassNames = [];
                          foreach ($list->getClasses() as $class => $blackListInfo) {
                  Severity: Minor
                  Found in lib/private/App/CodeChecker/NodeVisitor.php - About 1 hr to fix

                    Method parseHttpRangeHeader has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) {
                            $rArray=\explode(',', $rangeHeaderPos);
                            $minOffset = 0;
                            $ind = 0;
                    
                    
                    Severity: Minor
                    Found in lib/private/legacy/files.php - About 1 hr to fix

                      Method execute has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function execute($jobList, ILogger $logger = null) {
                              $jobList->setLastRun($this);
                              try {
                                  //storing job start time
                                  $jobStartTime = \time();
                      Severity: Minor
                      Found in lib/private/BackgroundJob/Job.php - About 1 hr to fix

                        Method setUserValue has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function setUserValue($userId, $appName, $key, $value, $preCondition = null) {
                                if (!\is_int($value) && !\is_float($value) && !\is_string($value)) {
                                    throw new \UnexpectedValueException('Only integers, floats and strings are allowed as value');
                                }
                        
                        
                        Severity: Minor
                        Found in lib/private/AllConfig.php - About 1 hr to fix

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

                                          $result[] = [
                                              'id'           => $row['id'],
                                              'uri'          => $row['uri'],
                                              'lastmodified' => $row['lastmodified'],
                                              'etag'         => '"' . $row['etag'] . '"',
                          Severity: Major
                          Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 hr to fix
                          apps/dav/lib/CalDAV/CalDavBackend.php on lines 736..746

                          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 109.

                          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

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

                                  return [
                                          'id'            => $row['id'],
                                          'uri'           => $row['uri'],
                                          'lastmodified'  => $row['lastmodified'],
                                          'etag'          => '"' . $row['etag'] . '"',
                          Severity: Major
                          Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 hr to fix
                          apps/dav/lib/CalDAV/CalDavBackend.php on lines 775..785

                          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 109.

                          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

                              public function postShared($params) {
                                  if ($this->encryptionManager->isEnabled()) {
                                      if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
                                          $path = Filesystem::getPath($params['fileSource']);
                                          list($owner, $ownerPath) = $this->getOwnerPath($path);
                          Severity: Major
                          Found in lib/private/Encryption/Update.php and 1 other location - About 1 hr to fix
                          lib/private/Encryption/Update.php on lines 98..107

                          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 109.

                          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

                              public function postUnshared($params) {
                                  if ($this->encryptionManager->isEnabled()) {
                                      if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
                                          $path = Filesystem::getPath($params['fileSource']);
                                          list($owner, $ownerPath) = $this->getOwnerPath($path);
                          Severity: Major
                          Found in lib/private/Encryption/Update.php and 1 other location - About 1 hr to fix
                          lib/private/Encryption/Update.php on lines 82..91

                          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 109.

                          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 manageMountPointError has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              manageMountPointError: function (name) {
                                  this.getMountStatus($.proxy(function (allMountStatus) {
                                      if (allMountStatus.hasOwnProperty(name) && allMountStatus[name].status > 0 && allMountStatus[name].status < 7) {
                                          var mountData = allMountStatus[name];
                                          if (mountData.type === "system") {
                          Severity: Minor
                          Found in apps/files_external/js/statusmanager.js - 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 translate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              translate: function(app, text, vars, count, options) {
                                  var defaultOptions = {
                                          escape: true
                                      },
                                      allOptions = options || {};
                          Severity: Minor
                          Found in core/js/l10n.js - 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 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function execute(InputInterface $input, OutputInterface $output): int {
                                  $remoteStorages = $this->getRemoteStorages();
                          
                                  $output->writeln(\count($remoteStorages) . " remote storage(s) need(s) to be checked");
                          
                          
                          Severity: Minor
                          Found in apps/files_sharing/lib/Command/CleanupRemoteStorages.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 stats has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function stats() {
                                  $userCount = 0;
                                  if ($this->isAdmin) {
                                      $countByBackend = $this->userManager->countUsers();
                          
                          
                          Severity: Minor
                          Found in settings/Controller/UsersController.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