CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php

Summary

Maintainability
D
2 days
Test Coverage

Function body_content has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function body_content()
    {
        $edit = FannieAuth::validateUserQuiet('edit_employees');

        $sort = $this->getSort();
Severity: Minor
Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.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 body_content has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function body_content()
    {
        $edit = FannieAuth::validateUserQuiet('edit_employees');

        $sort = $this->getSort();
Severity: Major
Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 3 hrs to fix

    Function checkAuth has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkAuth()
        { 
            $ALL = FannieAuth::validateUserQuiet('view_all_hours');
            if (!$ALL){
                $valid_depts = array(10,11,12,13,20,21,30,40,50,60,998);
    Severity: Minor
    Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.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

    File WfcHtListPage.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2013 Whole Foods Co-op
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 2 hrs to fix

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

          public function preprocess()
          {
              if (FormLib::get('showdept') !== '') {
                  $this->selected_dept = FormLib::get('showdept');
                  if (!empty($this->selected_dept) && $this->selected_dept != -1){
      Severity: Minor
      Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.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 preprocess has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function preprocess()
          {
              if (FormLib::get('showdept') !== '') {
                  $this->selected_dept = FormLib::get('showdept');
                  if (!empty($this->selected_dept) && $this->selected_dept != -1){
      Severity: Minor
      Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 1 hr to fix

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

            public function checkAuth()
            { 
                $ALL = FannieAuth::validateUserQuiet('view_all_hours');
                if (!$ALL){
                    $valid_depts = array(10,11,12,13,20,21,30,40,50,60,998);
        Severity: Minor
        Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 1 hr to fix

          Avoid too many return statements within this method.
          Open

                  return 'e.name';
          Severity: Major
          Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return 'h.totalhours';
            Severity: Major
            Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return 'u.hours';
              Severity: Major
              Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtListPage.php - About 30 mins to fix

                There are no issues that match your filters.

                Category
                Status