owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

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

    public static function updateHtaccess() {
        $config = \OC::$server->getConfig();
        $il10n = \OC::$server->getL10N('lib');

        // For CLI read the value from overwrite.cli.url
Severity: Minor
Found in lib/private/Setup.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 clear has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function clear($prefix = '') {
        $storage = $this->getStorage();
        if ($storage and $storage->is_dir('/')) {
            $dh = $storage->opendir('/');
            if (\is_resource($dh)) {
Severity: Minor
Found in lib/private/Cache/File.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 findAvailableLanguageFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findAvailableLanguageFiles($dir) {
        $availableLanguageFiles = [];
        if (\is_dir($dir)) {
            $files = \scandir($dir);
            if ($files !== false) {
Severity: Minor
Found in lib/private/L10N/Factory.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 loginWithApache has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function loginWithApache(IApacheBackend $apacheBackend) {
        $uidAndBackend = $apacheBackend->getCurrentUserId();
        if (\is_array($uidAndBackend)
            && \count($uidAndBackend) === 2
            && $uidAndBackend[0] !== ''
Severity: Minor
Found in lib/private/User/Session.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 guessTimeZoneFromOffset has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function guessTimeZoneFromOffset($offset, $timestamp) {
        try {
            // Note: the timeZone name is the inverse to the offset,
            // so a positive offset means negative timeZone
            // and the other way around.
Severity: Minor
Found in lib/private/DateTimeZone.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 checkInput has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkInput(InputInterface $input) {
        $uid = $input->getArgument('uid');
        if (!$input->getOption('ignore-missing-user') && !$this->userManager->userExists($uid)) {
            throw new \InvalidArgumentException('The user "' . $uid . '" does not exist.');
        }
Severity: Minor
Found in core/Command/User/Setting.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        if (Filesystem::isPrimaryObjectStorageEnabled() === true) {
            $output->writeln('<info>We detected that the instance is running on a S3 primary object storage, users might not be accurate</info>');
        }

Severity: Minor
Found in core/Command/User/HomeListUsers.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 sendEmail has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendEmail($user, $token, $link) {
        if ($this->userManager->userExists($user)) {
            $userObject = $this->userManager->get($user);
            $email = $userObject->getEMailAddress();

Severity: Minor
Found in core/Controller/LostController.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 buildWebUri has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildWebUri(array $app_info, string $fileId): ?string {
        $uri = null;
        $app_name = $app_info['oc_app_name'];
        # https://github.com/ONLYOFFICE/onlyoffice-owncloud/blob/2afca075249f24d857f0b3097d565f5129e88d17/appinfo/routes.php#LL27C47-L27C53
        if ($app_name === 'onlyoffice') {
Severity: Minor
Found in core/Controller/AppRegistryController.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 query has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                query: _.debounce(function(query) {
                    var queryData = {};
                    if (self._cachedGroups && query.term === '') {
                        query.callback({results: self._cachedGroups});
                        return;
Severity: Minor
Found in settings/js/settings.js - About 1 hr to fix

    Function calculate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            calculate: function(files) {
                var file;
                var summary = {
                    totalDirs: 0,
                    totalFiles: 0,
    Severity: Minor
    Found in apps/files/js/filesummary.js - About 1 hr to fix

      Function getDescriptiveTag has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              getDescriptiveTag: function(tag) {
                  if (_.isUndefined(tag.name) && !_.isUndefined(tag.toJSON)) {
                      tag = tag.toJSON();
                  }
      
      
      Severity: Minor
      Found in core/js/systemtags/systemtags.js - About 1 hr to fix

        Function addAndFetchFileInfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                addAndFetchFileInfo: function(fileName, dir, options) {
                    var self = this;
                    var deferred = $.Deferred();
                    if (_.isUndefined(dir)) {
                        dir = this.getCurrentDirectory();
        Severity: Minor
        Found in apps/files/js/filelist.js - About 1 hr to fix

          Function parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  parse: function(data) {
                      /* jshint camelcase: false */
                      if (data.ocs && data.ocs.data) {
                          // parse out of the ocs response
                          data = data.ocs.data;
          Severity: Minor
          Found in core/js/sharemodel.js - About 1 hr to fix

            Function lock has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    lock: function(path, options) {
                        if (!path) {
                            throw 'Missing argument "path"';
                        }
                        var self = this;
            Severity: Minor
            Found in core/js/files/client.js - About 1 hr to fix

              Function showHtml has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  showHtml: function (html, options) {
                      options = options || {};
                      _.defaults(options, {
                          timeout: 0
                      });
              Severity: Minor
              Found in core/js/js.js - About 1 hr to fix

                Method getPanel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getPanel() {
                        $activeLangCode = $this->config->getUserValue(
                            $this->userSession->getUser()->getUID(),
                            'core',
                            'lang',
                Severity: Minor
                Found in settings/Panels/Personal/Profile.php - About 1 hr to fix

                  Method isTargetAllowed has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function isTargetAllowed($target) {
                          $currentMount = $this->getMountPoint();
                          // note: $currentMount has a trailing slash. It doesn't matter for the check below
                          $isRename = \dirname($currentMount) === \dirname($target);
                  
                  
                  Severity: Minor
                  Found in apps/files_sharing/lib/SharedMount.php - About 1 hr to fix

                    Method setPasswordForm has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function setPasswordForm($token, $userId) {
                            try {
                                $this->checkPasswordSetToken($token, $userId);
                            } catch (UserTokenException $e) {
                                if ($e instanceof UserTokenExpiredException) {
                    Severity: Minor
                    Found in settings/Controller/UsersController.php - About 1 hr to fix

                      Method addCertificate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function addCertificate(ICertificateManager $certificateManager) {
                              $headers = [];
                              if ($this->request->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE_8])) {
                                  // due to upload iframe workaround, need to set content-type to text/plain
                                  $headers['Content-Type'] = 'text/plain';
                      Severity: Minor
                      Found in settings/Controller/CertificateController.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language