CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php

Summary

Maintainability
F
6 days
Test Coverage

Method renderAsPDF has 233 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function renderAsPDF($pdf, $start_y)
    {
        $top_left_x = 6.35;
        $top_left_y = $start_y;
        $line_height = 5;
Severity: Major
Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 1 day to fix

    File GumTaxFormTemplate.php has 422 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2014 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 6 hrs to fix

      Method renderAsHTML has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function renderAsHTML()
          {
              $ret = '<table style="border: 1px solid black; border-collapse: collapse;">';
      
              $ret .= '<tr>';
      Severity: Major
      Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 4 hrs to fix

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

            public function renderAsPDF($pdf, $start_y)
            {
                $top_left_x = 6.35;
                $top_left_y = $start_y;
                $line_height = 5;
        Severity: Minor
        Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.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 __construct has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
            {
                global $FANNIE_PLUGIN_SETTINGS;
                $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                $settings = new GumSettingsModel($dbc);
        Severity: Major
        Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 2 hrs to fix

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

              public function renderAsHTML()
              {
                  $ret = '<table style="border: 1px solid black; border-collapse: collapse;">';
          
                  $ret .= '<tr>';
          Severity: Minor
          Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.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 __construct has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
              {
                  global $FANNIE_PLUGIN_SETTINGS;
                  $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                  $settings = new GumSettingsModel($dbc);
          Severity: Minor
          Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
          Severity: Minor
          Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxFormTemplate.php - About 45 mins to fix

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

                public function __construct($custdata, $meminfo, $tax_id, $tax_year, $fields, $account_number='')
                {
                    global $FANNIE_PLUGIN_SETTINGS;
                    $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
                    $settings = new GumSettingsModel($dbc);
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxDividendFormTemplate.php on lines 37..96
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxMiscFormTemplate.php on lines 37..96

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

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

                    if (isset($this->their_address[2])) {
                        $pdf->SetXY($top_left_x, $start_y + 38.1 + 3*$small_height + 2*$med_height);
                        $pdf->SetFont('Arial', '', 8);
                        $pdf->Cell(88.9, $med_height, $this->their_address[2], 0, 0, 'C');
                        $pdf->SetFont('Arial', '', 6);
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxDividendFormTemplate.php on lines 508..513
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxMiscFormTemplate.php on lines 464..469

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

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

                    if (isset($this->their_address[1])) {
                        $pdf->SetXY($top_left_x, $start_y + 38.1 + 2*$small_height + $med_height);
                        $pdf->SetFont('Arial', '', 8);
                        $pdf->Cell(88.9, $med_height, $this->their_address[1], 0, 0, 'C');
                        $pdf->SetFont('Arial', '', 6);
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxDividendFormTemplate.php on lines 500..505
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxMiscFormTemplate.php on lines 456..461

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

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

                    if (isset($this->their_address[0])) {
                        $pdf->SetXY($top_left_x, $start_y + 38.1 + $small_height);
                        $pdf->SetFont('Arial', '', 8);
                        $pdf->Cell(88.9, $med_height, $this->their_address[0], 0, 0, 'C');
                        $pdf->SetFont('Arial', '', 6);
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxDividendFormTemplate.php on lines 492..497
            fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumTaxMiscFormTemplate.php on lines 448..453

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

            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