owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $appId = $input->getArgument('app-id');

        $checkList = new EmptyCheck();
        foreach ($input->getOption('checker') as $checker) {
Severity: Minor
Found in core/Command/App/CheckCode.php - About 45 mins 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 syncSingleUser has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        InputInterface $input,
        OutputInterface $output,
        SyncService $syncService,
        UserInterface $backend,
        $uid,
Severity: Minor
Found in core/Command/User/SyncBackend.php - About 45 mins to fix

    Function getLegacyThemes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getLegacyThemes() {
            $themes = [];
    
            if (\is_dir(\OC::$SERVERROOT . '/themes/')) {
                $legacyThemeDirectories = new \DirectoryIterator(\OC::$SERVERROOT . '/themes/');
    Severity: Minor
    Found in core/Command/Maintenance/Mimetype/UpdateJS.php - About 45 mins 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 writeJsFile has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private function writeJsFile($app, $path, $lang, OutputInterface $output, $translations, $plurals) {
    Severity: Minor
    Found in core/Command/L10n/CreateJs.php - About 45 mins to fix

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

          protected function execute(InputInterface $input, OutputInterface $output): int {
              if ($this->encryptionManager->isEnabled() === false) {
                  throw new \Exception('Server side encryption is not enabled');
              }
              $yes = $input->getOption('yes');
      Severity: Minor
      Found in core/Command/Encryption/EncryptAll.php - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                              if (isset($contact['isSystemBook'])) {
                                  continue;
                              }
      Severity: Major
      Found in core/ajax/share.php - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if (!\is_array($emails)) {
                                    $emails = [$emails];
                                }
        Severity: Major
        Found in core/ajax/share.php - About 45 mins to fix

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

              protected function execute(InputInterface $input, OutputInterface $output): int {
                  if ($this->encryptionManager->isEnabled()) {
                      $output->writeln('Encryption is already enabled');
                  } else {
                      // TODO add and use api to enable encryption
          Severity: Minor
          Found in core/Command/Encryption/Enable.php - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct($appName, IRequest $request, UserManager $userManager, IProvider $tokenProvider, TwoFactorAuthManager $twoFactorAuthManager, ISecureRandom $secureRandom) {
          Severity: Minor
          Found in core/Controller/TokenController.php - About 45 mins to fix

            Function beforeController has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function beforeController($controller, $methodName) {
                    if ($this->reflector->hasAnnotation('PublicPage')) {
                        // Don't block public pages
                        return;
                    }
            Severity: Minor
            Found in core/Middleware/AccountModuleMiddleware.php - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    $appName,
                    IRequest $request,
                    Manager $twoFactorManager,
                    IUserSession $userSession,
                    ISession $session,
            Severity: Minor
            Found in core/Controller/TwoFactorChallengeController.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if (\substr_count((string)$_GET['search'], '@') >= 1) {
                                      $shareWith[] = [
                                          'label' => (string)$_GET['search'],
                                          'value' => [
                                              'shareType' => \OCP\Share::SHARE_TYPE_REMOTE,
              Severity: Major
              Found in core/ajax/share.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if ((!isset($_GET['itemShares'])
                                            || !\is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])
                                            || !\in_array($uid, $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]))
                                            && $uid != OC_User::getUser()) {
                                            $shareWith[] = [
                Severity: Major
                Found in core/ajax/share.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (\in_array($uid, $sharedUsers)) {
                                              continue;
                                          }
                  Severity: Major
                  Found in core/ajax/share.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (isset($contact['CLOUD'])) {
                                                foreach ($contact['CLOUD'] as $cloudId) {
                                                    $shareWith[] = [
                                                        'label' => $contact['FN'] . ' (' . $cloudId . ')',
                                                        'value' => [
                    Severity: Major
                    Found in core/ajax/share.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) &&
                                              \is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
                                              $sharedGroups = $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP];
                                          }
                      Severity: Major
                      Found in core/ajax/share.php - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if (isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) &&
                                                \is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) {
                                                $sharedUsers = $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER];
                                            }
                        Severity: Major
                        Found in core/ajax/share.php - About 45 mins to fix

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

                          OC.L10N.register(
                              "files",
                              {
                              "_%n folder_::_%n folders_" : ["",""],
                              "_%n file_::_%n files_" : ["",""],
                          Severity: Major
                          Found in apps/files/l10n/tzm.js and 11 other locations - About 45 mins to fix
                          apps/files/l10n/ach.js on lines 1..9
                          apps/files/l10n/ady.js on lines 1..9
                          apps/files/l10n/ak.js on lines 1..9
                          apps/files/l10n/am_ET.js on lines 1..9
                          apps/files/l10n/fy_NL.js on lines 1..9
                          apps/files/l10n/io.js on lines 1..9
                          apps/files/l10n/mg.js on lines 1..9
                          apps/files/l10n/ml.js on lines 1..9
                          apps/files/l10n/sw_KE.js on lines 1..9
                          apps/files/l10n/tg_TJ.js on lines 1..9
                          apps/files/l10n/tl_PH.js on lines 1..9

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

                          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 12 locations. Consider refactoring.
                          Open

                          OC.L10N.register(
                              "files",
                              {
                              "_%n folder_::_%n folders_" : ["",""],
                              "_%n file_::_%n files_" : ["",""],
                          Severity: Major
                          Found in apps/files/l10n/ak.js and 11 other locations - About 45 mins to fix
                          apps/files/l10n/ach.js on lines 1..9
                          apps/files/l10n/ady.js on lines 1..9
                          apps/files/l10n/am_ET.js on lines 1..9
                          apps/files/l10n/fy_NL.js on lines 1..9
                          apps/files/l10n/io.js on lines 1..9
                          apps/files/l10n/mg.js on lines 1..9
                          apps/files/l10n/ml.js on lines 1..9
                          apps/files/l10n/sw_KE.js on lines 1..9
                          apps/files/l10n/tg_TJ.js on lines 1..9
                          apps/files/l10n/tl_PH.js on lines 1..9
                          apps/files/l10n/tzm.js on lines 1..9

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

                          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 12 locations. Consider refactoring.
                          Open

                          OC.L10N.register(
                              "files",
                              {
                              "_%n folder_::_%n folders_" : ["",""],
                              "_%n file_::_%n files_" : ["",""],
                          Severity: Major
                          Found in apps/files/l10n/ach.js and 11 other locations - About 45 mins to fix
                          apps/files/l10n/ady.js on lines 1..9
                          apps/files/l10n/ak.js on lines 1..9
                          apps/files/l10n/am_ET.js on lines 1..9
                          apps/files/l10n/fy_NL.js on lines 1..9
                          apps/files/l10n/io.js on lines 1..9
                          apps/files/l10n/mg.js on lines 1..9
                          apps/files/l10n/ml.js on lines 1..9
                          apps/files/l10n/sw_KE.js on lines 1..9
                          apps/files/l10n/tg_TJ.js on lines 1..9
                          apps/files/l10n/tl_PH.js on lines 1..9
                          apps/files/l10n/tzm.js on lines 1..9

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

                          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