CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php

Summary

Maintainability
F
1 wk
Test Coverage

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

    private function getTopImage($item)
    {
        // Manual Signs Page && smartType override checked takes precedence
        if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
            return __DIR__ . '/noauto/images/codeals_top_12.png';
Severity: Minor
Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.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 getBottomImage has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    private function getBottomImage($item)
    {
        // Manual Signs Page && smartType override checked takes precedence
        if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
            return __DIR__ . '/cd_line_16.png';
Severity: Minor
Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.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 drawPDF has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function drawPDF()
    {
        $pdf = $this->createPDF();
        $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
        $basicP = $dbc->prepare("SELECT
Severity: Major
Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 2 hrs to fix

    Function drawPDF has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function drawPDF()
        {
            $pdf = $this->createPDF();
            $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
            $basicP = $dbc->prepare("SELECT
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.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

    Consider simplifying this complex logical expression.
    Open

            if (strstr($item['batchName'], 'Co-op Deals') && !strstr($item['batchName'], 'TPR') && $item['signMultiplier'] != -3) {
                return 'EXTRAS';
            } elseif (strstr($item['batchName'], 'Co-op Deals') && !strstr($item['batchName'], 'TPR') && $item['signMultiplier'] == -3) {
                return __DIR__ . '/cd_line_16.png';
            } elseif (isset($item['batchName']) && strstr(strtoupper($item['batchName']), 'FRESH DEALS')) {
    Severity: Critical
    Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 1 hr to fix

      Method getTopImage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getTopImage($item)
          {
              // Manual Signs Page && smartType override checked takes precedence
              if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                  return __DIR__ . '/noauto/images/codeals_top_12.png';
      Severity: Minor
      Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 1 hr to fix

        Method getBottomImage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getBottomImage($item)
            {
                // Manual Signs Page && smartType override checked takes precedence
                if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                    return __DIR__ . '/cd_line_16.png';
        Severity: Minor
        Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (strstr($item['batchName'], 'Co-op Deals') && !strstr($item['batchName'], 'TPR')) {
                      return __DIR__ . '/noauto/images/codeals_top_12.png';
                  } elseif (isset($item['batchName']) && strstr(strtoupper($item['batchName']), 'FRESH DEALS')) {
                      return __DIR__ . '/noauto/images/freshdeals_top_4.png';
                  } elseif (!empty($item['batchName']) && ((isset($item['batchType']) && $item['batchType'] != 4) || !isset($item['batchType']))) {
          Severity: Major
          Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 40 mins to fix

            Avoid too many return statements within this method.
            Open

                        return 'EXTRAS';
            Severity: Major
            Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return __DIR__ . '/noauto/images/organic_bottom_12.png';
              Severity: Major
              Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return __DIR__ . '/noauto/images/local_og_bottom.png';
                Severity: Major
                Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return __DIR__ . '/noauto/images/local-top.png';
                  Severity: Major
                  Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return __DIR__ . '/noauto/images/local_og_top.png';
                    Severity: Major
                    Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return __DIR__ . '/noauto/images/freshdeals_top_4.png';
                      Severity: Major
                      Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return __DIR__ . '/noauto/images/local-top.png';
                        Severity: Major
                        Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return __DIR__ . '/noauto/images/basics_top_12.png';
                          Severity: Major
                          Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return __DIR__ . '/noauto/images/local-bottom.png';
                            Severity: Major
                            Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return __DIR__ . '/noauto/images/standard_top_12.png';
                              Severity: Major
                              Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return __DIR__ . '/noauto/images/organic_bottom_12.png';
                                Severity: Major
                                Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return __DIR__ . '/noauto/images/chaching_top_12.png';
                                  Severity: Major
                                  Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return __DIR__ . '/cd_line_16.png';
                                    Severity: Major
                                    Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return __DIR__ . '/noauto/images/chaching_bottom_12.png';
                                      Severity: Major
                                      Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return __DIR__ . '/noauto/images/standard_bottom_12.png';
                                        Severity: Major
                                        Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return __DIR__ . '/noauto/images/organic_top_12.png';
                                          Severity: Major
                                          Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return __DIR__ . '/noauto/images/organic_top_12.png';
                                            Severity: Major
                                            Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return __DIR__ . '/noauto/images/basics_bottom_12.png';
                                              Severity: Major
                                              Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            return __DIR__ . '/noauto/images/codeals_top_12.png';
                                                Severity: Major
                                                Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                              return __DIR__ . '/noauto/images/local_og_top.png';
                                                  Severity: Major
                                                  Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                return __DIR__ . '/noauto/images/freshdeals_bottom_4.png';
                                                    Severity: Major
                                                    Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns12UpP.php - About 30 mins to fix

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

                                                          private function getBottomImage($item)
                                                          {
                                                              // Manual Signs Page && smartType override checked takes precedence
                                                              if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                                                                  return __DIR__ . '/cd_line_16.png';
                                                      fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns16UpP.php on lines 147..181
                                                      fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns4UpP.php on lines 160..196

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

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

                                                          private function getTopImage($item)
                                                          {
                                                              // Manual Signs Page && smartType override checked takes precedence
                                                              if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                                                                  return __DIR__ . '/noauto/images/codeals_top_12.png';
                                                      fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns12UpP.php on lines 100..136
                                                      fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns16UpP.php on lines 86..122
                                                      fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns16UpP.php on lines 109..145
                                                      fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns4UpP.php on lines 122..158

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

                                                      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