owncloud/core

View on GitHub
lib/private/Share20/Manager.php

Summary

Maintainability
F
1 wk
Test Coverage

File Manager.php has 1180 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
 * @author Björn Schießle <bjoern@schiessle.org>
 * @author Joas Schilling <coding@schilljs.com>
Severity: Major
Found in lib/private/Share20/Manager.php - About 3 days to fix

    Manager has 69 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Manager implements IManager {
        /** @var IProviderFactory */
        private $factory;
        /** @var ILogger */
        private $logger;
    Severity: Major
    Found in lib/private/Share20/Manager.php - About 1 day to fix

      Function validatePermissions has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function validatePermissions(IShare $share) {
              // Permissions should be set
              if ($share->getPermissions() === null) {
                  throw new \InvalidArgumentException('A share requires permissions');
              }
      Severity: Minor
      Found in lib/private/Share20/Manager.php - About 5 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 transferShare has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public function transferShare(IShare $share, $oldOwner, $newOwner, $finalTarget, $isChild = null) {
              if ($this->userManager->get($oldOwner) === null) {
                  throw new TransferSharesException("The current owner of the share $oldOwner doesn't exist");
              }
              if ($this->userManager->get($newOwner) === null) {
      Severity: Minor
      Found in lib/private/Share20/Manager.php - About 4 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 updateShare has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          public function updateShare(\OCP\Share\IShare $share, $skipExpirationValidation = false) {
              $expirationDateUpdated = false;
      
              $this->canShare($share);
      
      
      Severity: Minor
      Found in lib/private/Share20/Manager.php - About 4 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

      Method updateShare has 104 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function updateShare(\OCP\Share\IShare $share, $skipExpirationValidation = false) {
              $expirationDateUpdated = false;
      
              $this->canShare($share);
      
      
      Severity: Major
      Found in lib/private/Share20/Manager.php - About 4 hrs to fix

        Function getSharesBy has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
                if ($path !== null &&
                        !($path instanceof \OCP\Files\File) &&
                        !($path instanceof \OCP\Files\Folder)) {
                    throw new \InvalidArgumentException('invalid path');
        Severity: Minor
        Found in lib/private/Share20/Manager.php - About 3 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

        Method createShare has 97 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createShare(\OCP\Share\IShare $share) {
                $this->canShare($share);
        
                // Verify if there are any issues with the path
                $this->pathCreateChecks($share->getNode());
        Severity: Major
        Found in lib/private/Share20/Manager.php - About 3 hrs to fix

          Function getSharedWith has a Cognitive Complexity of 25 (exceeds 5 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 3 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 generalChecks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function generalChecks(\OCP\Share\IShare $share) {
                  if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                      // We expect a valid user as sharedWith for user shares
                      if (!$this->userManager->userExists($share->getSharedWith())) {
                          throw new \InvalidArgumentException('SharedWith is not a valid user');
          Severity: Minor
          Found in lib/private/Share20/Manager.php - About 3 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 userCreateChecks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function userCreateChecks(\OCP\Share\IShare $share) {
                  $userTypeHelper = new UserTypeHelper();
                  $isGuestUser = $userTypeHelper->isGuestUser($share->getSharedWith());
                  // Check if we can share with group members only
                  // We still should be able to share with guest user even when it's not a group member
          Severity: Minor
          Found in lib/private/Share20/Manager.php - About 3 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

          Method validateExpirationDate has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function validateExpirationDate(\OCP\Share\IShare $share, $skipPastDateValidation = false) {
                  $expirationDate = $share->getExpirationDate();
          
                  if ($expirationDate !== null) {
                      // Set the expiration date to just the date at "zero" time in the day
          Severity: Major
          Found in lib/private/Share20/Manager.php - About 2 hrs to fix

            Method validatePermissions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function validatePermissions(IShare $share) {
                    // Permissions should be set
                    if ($share->getPermissions() === null) {
                        throw new \InvalidArgumentException('A share requires permissions');
                    }
            Severity: Major
            Found in lib/private/Share20/Manager.php - About 2 hrs to fix

              Function validateExpirationDate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function validateExpirationDate(\OCP\Share\IShare $share, $skipPastDateValidation = false) {
                      $expirationDate = $share->getExpirationDate();
              
                      if ($expirationDate !== null) {
                          // Set the expiration date to just the date at "zero" time in the day
              Severity: Minor
              Found in lib/private/Share20/Manager.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

              Method transferShare has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function transferShare(IShare $share, $oldOwner, $newOwner, $finalTarget, $isChild = null) {
                      if ($this->userManager->get($oldOwner) === null) {
                          throw new TransferSharesException("The current owner of the share $oldOwner doesn't exist");
                      }
                      if ($this->userManager->get($newOwner) === null) {
              Severity: Major
              Found in lib/private/Share20/Manager.php - About 2 hrs to fix

                Function createShare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createShare(\OCP\Share\IShare $share) {
                        $this->canShare($share);
                
                        // Verify if there are any issues with the path
                        $this->pathCreateChecks($share->getNode());
                Severity: Minor
                Found in lib/private/Share20/Manager.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 getShareByToken has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getShareByToken($token) {
                        $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
                
                        try {
                            $share = $provider->getShareByToken($token);
                Severity: Minor
                Found in lib/private/Share20/Manager.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

                Method getShareByToken has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getShareByToken($token) {
                        $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
                
                        try {
                            $share = $provider->getShareByToken($token);
                Severity: Minor
                Found in lib/private/Share20/Manager.php - About 1 hr to fix

                  Method __construct has 15 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          ILogger $logger,
                          IConfig $config,
                          ISecureRandom $secureRandom,
                          IHasher $hasher,
                          IMountManager $mountManager,
                  Severity: Major
                  Found in lib/private/Share20/Manager.php - About 1 hr to fix

                    Method generalChecks has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function generalChecks(\OCP\Share\IShare $share) {
                            if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                                // We expect a valid user as sharedWith for user shares
                                if (!$this->userManager->userExists($share->getSharedWith())) {
                                    throw new \InvalidArgumentException('SharedWith is not a valid user');
                    Severity: Minor
                    Found in lib/private/Share20/Manager.php - About 1 hr to fix

                      Function groupCreateChecks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function groupCreateChecks(\OCP\Share\IShare $share) {
                              // Verify group shares are allowed
                              if (!$this->allowGroupSharing()) {
                                  throw new \Exception('Group sharing is not allowed');
                              }
                      Severity: Minor
                      Found in lib/private/Share20/Manager.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

                      Method getSharesBy has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
                              if ($path !== null &&
                                      !($path instanceof \OCP\Files\File) &&
                                      !($path instanceof \OCP\Files\Folder)) {
                                  throw new \InvalidArgumentException('invalid path');
                      Severity: Minor
                      Found in lib/private/Share20/Manager.php - About 1 hr to fix

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

                            public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares = false) {
                                // This function requires at least 1 node (parent folder)
                                if (empty($nodeIDs)) {
                                    throw new \InvalidArgumentException('Array of nodeIDs empty');
                                }
                        Severity: Minor
                        Found in lib/private/Share20/Manager.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

                        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

                          Function getAllSharedWith has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getAllSharedWith($userId, $shareTypes, $node = null) {
                                  $shares = [];
                          
                                  // Aggregate all required $shareTypes by mapping provider to supported shareTypes
                                  $providerIdMap = $this->shareTypeToProviderMap($shareTypes);
                          Severity: Minor
                          Found in lib/private/Share20/Manager.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

                          Method userCreateChecks has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function userCreateChecks(\OCP\Share\IShare $share) {
                                  $userTypeHelper = new UserTypeHelper();
                                  $isGuestUser = $userTypeHelper->isGuestUser($share->getSharedWith());
                                  // Check if we can share with group members only
                                  // We still should be able to share with guest user even when it's not a group member
                          Severity: Minor
                          Found in lib/private/Share20/Manager.php - About 1 hr to fix

                            Method getSharesBy has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
                            Severity: Minor
                            Found in lib/private/Share20/Manager.php - About 45 mins to fix

                              Method transferShare has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function transferShare(IShare $share, $oldOwner, $newOwner, $finalTarget, $isChild = null) {
                              Severity: Minor
                              Found in lib/private/Share20/Manager.php - About 35 mins to fix

                                Method getSharedWith has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) {
                                Severity: Minor
                                Found in lib/private/Share20/Manager.php - About 35 mins to fix

                                  Function sharingDisabledForUser has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function sharingDisabledForUser($userId) {
                                          if ($userId === null) {
                                              return false;
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in lib/private/Share20/Manager.php - About 35 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

                                  Function cleanSharesWithInvalidNodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function cleanSharesWithInvalidNodes() {
                                          $types = [
                                              \OCP\Share::SHARE_TYPE_USER,
                                              \OCP\Share::SHARE_TYPE_GROUP,
                                              \OCP\Share::SHARE_TYPE_LINK,
                                  Severity: Minor
                                  Found in lib/private/Share20/Manager.php - About 35 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

                                  Function pathCreateChecks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function pathCreateChecks($path) {
                                          // Make sure that we do not share a path that contains a shared mountpoint
                                          if ($path instanceof \OCP\Files\Folder) {
                                              $mounts = $this->mountManager->findIn($path->getPath());
                                              foreach ($mounts as $mount) {
                                  Severity: Minor
                                  Found in lib/private/Share20/Manager.php - About 25 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

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

                                              foreach ($shares as $share) {
                                                  // Check if the share is expired and if so delete it
                                                  if (self::shareHasExpired($share)) {
                                                      $this->activityManager->setAgentAuthor(IEvent::AUTOMATION_AUTHOR);
                                                      try {
                                  Severity: Minor
                                  Found in lib/private/Share20/Manager.php and 1 other location - About 45 mins to fix
                                  lib/private/Share20/Manager.php on lines 1382..1401

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

                                  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

                                              foreach ($shares as $share) {
                                                  // Check if the share is expired and if so delete it
                                                  if (self::shareHasExpired($share)) {
                                                      $this->activityManager->setAgentAuthor(IEvent::AUTOMATION_AUTHOR);
                                                      try {
                                  Severity: Minor
                                  Found in lib/private/Share20/Manager.php and 1 other location - About 45 mins to fix
                                  lib/private/Share20/Manager.php on lines 1320..1339

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

                                  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

                                  There are no issues that match your filters.

                                  Category
                                  Status