DerDu/SPHERE-Framework

View on GitHub
Application/Api/Billing/Bookkeeping/ApiBasketVerification.php

Summary

Maintainability
F
1 wk
Test Coverage

File ApiBasketVerification.php has 712 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace SPHERE\Application\Api\Billing\Bookkeeping;

use SPHERE\Application\Api\ApiTrait;
Severity: Major
Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 1 day to fix

    Function formDebtorSelection has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public function formDebtorSelection($BasketVerificationId = '')
        {
    
            // choose between Add and Edit
            $SaveButton = new Primary('Speichern', self::getEndpoint(), new Save());
    Severity: Minor
    Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 6 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 checkInputDebtorSelection has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkInputDebtorSelection(
            $BasketVerificationId = '',
            $DebtorSelection = array()
        ){
    
    
    Severity: Minor
    Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 6 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 formDebtorSelection has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function formDebtorSelection($BasketVerificationId = '')
        {
    
            // choose between Add and Edit
            $SaveButton = new Primary('Speichern', self::getEndpoint(), new Save());
    Severity: Major
    Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 4 hrs to fix

      Function saveEditDebtorSelection has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public function saveEditDebtorSelection(
              $BasketVerificationId,
              $DebtorSelection = array()
          ){
      
      
      Severity: Minor
      Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.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 saveEditDebtorSelection has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function saveEditDebtorSelection(
              $BasketVerificationId,
              $DebtorSelection = array()
          ){
      
      
      Severity: Major
      Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 3 hrs to fix

        ApiBasketVerification has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ApiBasketVerification extends Extension implements IApiInterface
        {
        
            // registered method
            use ApiTrait;
        Severity: Minor
        Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 3 hrs to fix

          Method checkInputDebtorSelection has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function checkInputDebtorSelection(
                  $BasketVerificationId = '',
                  $DebtorSelection = array()
              ){
          
          
          Severity: Major
          Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 2 hrs to fix

            Method showDeleteBasketSelection has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function showDeleteBasketSelection($Identifier = '', $BasketVerificationId = '')
                {
            
                    $tblBasketVerification = Basket::useService()->getBasketVerificationById($BasketVerificationId);
                    if($tblBasketVerification){
            Severity: Major
            Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 2 hrs to fix

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

                  public function getWarning($BasketVerificationId)
                  {
              
                      $IsDebtorNumberNeed = false;
                      if($tblSetting = Setting::useService()->getSettingByIdentifier(TblSetting::IDENT_IS_DATEV)){
              Severity: Minor
              Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.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 getDebtor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getDebtor($BasketVerificationId)
                  {
              
                      if(($tblBasketVerification = Basket::useService()->getBasketVerificationById($BasketVerificationId))){
                          $InfoDebtorNumber = '';
              Severity: Minor
              Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.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 pipelineCloseDebtorSelectionModal has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function pipelineCloseDebtorSelectionModal($BasketVerificationId = '')
                  {
                      $Pipeline = new Pipeline();
                      // reload columns
                      // reload debtor column
              Severity: Minor
              Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 1 hr to fix

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

                    public function showDeleteBasketSelection($Identifier = '', $BasketVerificationId = '')
                    {
                
                        $tblBasketVerification = Basket::useService()->getBasketVerificationById($BasketVerificationId);
                        if($tblBasketVerification){
                Severity: Minor
                Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.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($_POST['DebtorSelection']['BankReference'])){
                                            $_POST['DebtorSelection']['BankReference'] = $tblBankReferenceList[0]->getId();
                                        }
                Severity: Major
                Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if($tblBasket && new \DateTime($tblBankReference->getReferenceDate()) > new \DateTime($tblBasket->getTargetTime())){
                                                  $form->setError('DebtorSelection[BankReference]', 'Die ausgewählte Mandatsreferenznummer 
                                                  ist zum akuellen Fälligkeitsdatum ('.$tblBasket->getTargetTime().') noch nicht verfügbar.');
                                                  $Error = true;
                                              }
                  Severity: Major
                  Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php - About 45 mins to fix

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

                                if(isset($DebtorSelection['Price']) && empty($DebtorSelection['Price']) && $DebtorSelection['Price'] !== '0'){
                                    $Warning .= new Danger('Bitte geben Sie einen individuellen Preis an.');
                    //                $form->setError('DebtorSelection[Price]', 'Bitte geben Sie einen Individuellen Preis an');
                                    $Error = true;
                                } elseif(isset($DebtorSelection['Price']) && !is_numeric(str_replace(',', '.',
                    Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 690..702

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

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

                        public static function pipelineDeleteDebtorSelection($Identifier = '', $BasketVerificationId = '')
                        {
                    
                            $Receiver = self::receiverModal(null, $Identifier);
                            $Pipeline = new Pipeline(false);
                    Application/Api/Billing/Accounting/ApiCreditor.php on lines 165..181
                    Application/Api/Billing/Bookkeeping/ApiBasket.php on lines 203..219
                    Application/Api/Billing/Inventory/ApiItem.php on lines 190..206

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

                    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 exportApi($Method = '')
                        {
                            $Dispatcher = new Dispatcher(__CLASS__);
                            // reload ColumnContent
                            $Dispatcher->registerMethod('getWarning');
                    Application/Api/Billing/Inventory/ApiDocument.php on lines 56..77

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

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

                        public static function pipelineOpenDeleteDebtorSelectionModal($Identifier = '', $BasketVerificationId = '')
                        {
                    
                            $Receiver = self::receiverModal(null, $Identifier);
                            $Pipeline = new Pipeline();
                    Application/Api/Billing/Accounting/ApiBankAccount.php on lines 121..137
                    Application/Api/Billing/Accounting/ApiBankReference.php on lines 125..141
                    Application/Api/Billing/Accounting/ApiCreditor.php on lines 189..205
                    Application/Api/Billing/Accounting/ApiCreditor.php on lines 213..229
                    Application/Api/Billing/Accounting/ApiDebtor.php on lines 128..144
                    Application/Api/Billing/Bookkeeping/ApiBasket.php on lines 227..243
                    Application/Api/Billing/Bookkeeping/ApiBasket.php on lines 251..267
                    Application/Api/Billing/Inventory/ApiItem.php on lines 214..230
                    Application/Api/Billing/Inventory/ApiItem.php on lines 238..254
                    Application/Api/Billing/Inventory/ItemCalculation.php on lines 149..165
                    Application/Api/Billing/Inventory/ItemCalculation.php on lines 173..189
                    Application/Api/Billing/Inventory/ItemVariant.php on lines 148..164
                    Application/Api/Billing/Inventory/ItemVariant.php on lines 172..188

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

                    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

                                return new Layout(
                                    new LayoutGroup(
                                        new LayoutRow(array(
                                            new LayoutColumn(
                                                new Panel('Soll die Zahlung wirklich entfernt werden?'
                    Application/Api/Billing/Accounting/ApiCreditor.php on lines 533..547

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

                    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

                                        if(isset($DebtorSelection['BankAccount']) && empty($DebtorSelection['BankAccount'])){
                                            $Warning .= new Warning('Bitte geben Sie eine Bankverbindung an. (Eine Bankverbindung wird benötigt,
                                             um ein SEPA-Lastschriftverfahren zu hinterlegen) Wahlweise andere Bezahlart auswählen.');
                                            $form->setError('DebtorSelection[BankAccount]', 'Bitte geben Sie eine Bankverbindung an');
                                            $Error = true;
                    Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 722..732

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

                    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

                                if($tblPersonCauser){
                                    $PersonTitle = ' für '.new Bold($tblPersonCauser->getFirstName().' '.$tblPersonCauser->getLastName());
                                    $ObjectList = ApiDebtorSelection::getSelectBoxDebtor($tblPersonCauser);
                                    if(isset($ObjectList['SelectBoxDebtorList']) && $ObjectList['SelectBoxDebtorList']){
                                        $SelectBoxDebtorList = $ObjectList['SelectBoxDebtorList'];
                    Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 426..435

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

                    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

                                    if($tblBankReferenceList){
                                        // Post first entry if PaymentType = SEPA-Lastschrift
                                        if(isset($_POST['DebtorSelection']['PaymentType'])
                                            && ($tblPaymentType = Balance::useService()->getPaymentTypeById($_POST['DebtorSelection']['PaymentType']))
                                            && $tblPaymentType->getName() == 'SEPA-Lastschrift'){
                    Severity: Minor
                    Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php and 1 other location - About 45 mins to fix
                    Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 451..460

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

                    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 static function pipelineOpenEditDebtorSelectionModal(
                            $BasketVerificationId,
                            $DebtorSelection = array()
                        ){
                    
                    
                    Severity: Minor
                    Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php and 1 other location - About 40 mins to fix
                    Application/Api/Billing/Bookkeeping/ApiBasket.php on lines 275..291

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

                    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

                                    new FormRow(array(
                                        new FormColumn(
                                            array(
                                                new Bold('Varianten '.new DangerText('*')),
                                                new Listing($RadioBoxListVariant)
                    Severity: Minor
                    Found in Application/Api/Billing/Bookkeeping/ApiBasketVerification.php and 1 other location - About 30 mins to fix
                    Application/Api/Billing/Accounting/ApiDebtorSelection.php on lines 481..494

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

                    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