CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/CoopCred/reports/ProgramEvents/ProgramEventsReport.php

Summary

Maintainability
D
3 days
Test Coverage

File ProgramEventsReport.php has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2013 Whole Foods Co-op
    Copyright 2014 West End Food Co-op, Toronto

    Method fetch_report_data has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function fetch_report_data(){
    
            global $FANNIE_ARCHIVE_METHOD, $FANNIE_ARCHIVE_DB,
                $FANNIE_OP_DB, $FANNIE_TRANS_DB;
    
    

      Method form_content has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function form_content(){
      
              global $FANNIE_PLUGIN_SETTINGS;
      
              $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);

        Function preprocess has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            function preprocess(){
                global $FANNIE_URL,$FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
        
                if (!isset($FANNIE_PLUGIN_LIST) || !in_array('CoopCred', $FANNIE_PLUGIN_LIST)) {
                    $this->errors[] = "The Coop Cred plugin is not enabled.";

        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 fetch_report_data has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            function fetch_report_data(){
        
                global $FANNIE_ARCHIVE_METHOD, $FANNIE_ARCHIVE_DB,
                    $FANNIE_OP_DB, $FANNIE_TRANS_DB;
        
        

        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 preprocess has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function preprocess(){
                global $FANNIE_URL,$FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
        
                if (!isset($FANNIE_PLUGIN_LIST) || !in_array('CoopCred', $FANNIE_PLUGIN_LIST)) {
                    $this->errors[] = "The Coop Cred plugin is not enabled.";

          Function form_content has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              function form_content(){
          
                  global $FANNIE_PLUGIN_SETTINGS;
          
                  $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);

          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 too many return statements within this method.
          Open

                          return True;

            Avoid too many return statements within this method.
            Open

                    return True;

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

                  function calculate_footers($data){
                      $sumProgram = 0.0;
                      if ($this->sortable) {
                          foreach($data as $row){
                              $sumProgram += $row[5];

              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

              There are no issues that match your filters.

              Category
              Status