CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php

Summary

Maintainability
F
5 days
Test Coverage

Method get_id_view has 176 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function get_id_view()
    {
        $settings = $this->config->get('PLUGIN_SETTINGS');
        $prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
        $store = FormLib::get('store', 0);
Severity: Major
Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php - About 7 hrs to fix

    Function get_id_view has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function get_id_view()
        {
            $settings = $this->config->get('PLUGIN_SETTINGS');
            $prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
            $store = FormLib::get('store', 0);
    Severity: Minor
    Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.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

    File ObfBigBoardReport.php has 418 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    use COREPOS\Fannie\API\lib\Stats;
    use COREPOS\Fannie\API\item\ItemText;
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php - About 6 hrs to fix

      Method getPlanSales has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getPlanSales($catID, $weekID)
          {
              $ttl = 0;
              $plan = $this->PLAN_SALES_Q1_2018;
              if ($weekID >= 218) {
      Severity: Minor
      Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php - About 1 hr to fix

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

            protected function getPlanSales($catID, $weekID)
            {
                $ttl = 0;
                $plan = $this->PLAN_SALES_Q1_2018;
                if ($weekID >= 218) {
        Severity: Minor
        Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.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 get_view has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function get_view()
            {
                $settings = $this->config->get('PLUGIN_SETTINGS');
                $prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
                $query = "SELECT obfWeekID, startDate, endDate
        Severity: Minor
        Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php - About 1 hr to fix

          Avoid too many return statements within this method.
          Open

                  return 162;
          Severity: Major
          Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php - About 30 mins to fix

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

                private function weekToYM($weekID)
                {
                    $prep = $this->connection->prepare('SELECT startDate
                        FROM ' . FannieDB::fqn('ObfWeeks', 'plugin:ObfDatabaseV2') . '
                        WHERE obfWeekID=?');
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 242..264

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

            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

                protected $PLAN_SALES_Q2_2018 = array(
                    '1,6' => 51031.00,      // Hillside Produce
                    '2,10' => 11448.32,     // Hillside Deli
                    '2,11' => 31119.86,
                    '2,16' => 12686.82,
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 35..60
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 89..114
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 116..141
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 50..75
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 77..102
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 104..129
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 131..156
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 158..183
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 99..124
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 126..151
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 153..178
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 180..205
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 207..232

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

            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

                protected $PLAN_SALES_Q1_2018 = array(
                    '1,6' => 53904.29,      // Hillside Produce
                    '2,10' => 12187.19,     // Hillside Deli
                    '2,11' => 33128.32,
                    '2,16' => 13505.62,
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 62..87
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 89..114
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 116..141
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 50..75
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 77..102
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 104..129
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 131..156
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 158..183
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 99..124
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 126..151
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 153..178
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 180..205
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 207..232

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

            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

                protected $PLAN_SALES_Q3_2018 = array(
                    '1,6' => 51510.00,      // Hillside Produce
                    '2,10' => 11676.94,     // Hillside Deli
                    '2,11' => 31742.34,
                    '2,16' => 12940.72,
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 35..60
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 62..87
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 116..141
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 50..75
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 77..102
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 104..129
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 131..156
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 158..183
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 99..124
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 126..151
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 153..178
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 180..205
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 207..232

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

            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

                protected $PLAN_SALES_Q4_2018 = array(
                    '1,6' => 52231.00,      // Hillside Produce
                    '2,10' => 11840.47,     // Hillside Deli
                    '2,11' => 32186.37,
                    '2,16' => 13122.16,
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 35..60
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 62..87
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 89..114
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 50..75
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 77..102
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 104..129
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 131..156
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 158..183
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 99..124
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 126..151
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 153..178
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 180..205
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 207..232

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

            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 ($i == 0) {
                            $ret .= '<td class="text-right">' . number_format($totals[$i]['actual']) . '</td>';
                            $ret .= '<td class="text-right">' . number_format($totals[$i]['actual'] - $totals[$i]['plan']) . '</td>';
                            $ret.= '<td class="text-right">' . number_format($totals[$i]['aggOU']) . '</td>';
                        }
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 381..385

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

            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 ($i == 0) {
                            $ret .= '<td class="text-right">' . number_format($totals[$i]['actualHours']) . '</td>';
                            $ret .= '<td class="text-right">' . number_format($totals[$i]['actualHours'] - $totals[$i]['planHours']) . '</td>';
                            $ret .= '<td class="text-right">' . number_format($totals[$i]['hoursOU']) . '</td>';
                        }
            fannie/modules/plugins2.0/OpenBookFinancingV2/ObfBigBoardReport.php on lines 371..375

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

            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