CORE-POS/IS4C

View on GitHub
fannie/admin/labels/LikeCodeBatchSigns.php

Summary

Maintainability
D
2 days
Test Coverage
F
35%

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

    protected function get_id_view()
    {
        $query = 'SELECT * FROM batchList WHERE batchID=?';
        if (!FormLib::get('all')) {
            $query .= ' AND signMultiplier=0';
Severity: Major
Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 1 day to fix

    File LikeCodeBatchSigns.php has 400 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    include(dirname(__FILE__) . '/../../config.php');
    if (!class_exists('FannieAPI')) {
        include_once(__DIR__ . '/../../classlib2.0/FannieAPI.php');
    Severity: Minor
    Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 5 hrs to fix

      Method post_id_handler has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function post_id_handler()
          {
              $mod  = FormLib::get('sign');
              if (substr($mod, 0, 7) == 'Legacy:') {
                  COREPOS\Fannie\API\item\signage\LegacyWrapper::setWrapped(substr($mod, 7));
      Severity: Minor
      Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 1 hr to fix

        Method post_edit_handler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function post_edit_handler()
            {
                $dbc = FannieDB::get($this->config->get('OP_DB'));
        
                $upcs = array();
        Severity: Minor
        Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 1 hr to fix

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

              private function getSignOpts()
              {
                  $mods = FannieAPI::listModules('\COREPOS\Fannie\API\item\FannieSignage');
                  $enabled = $this->config->get('ENABLED_SIGNAGE');
                  if (count($enabled) > 0) {
          Severity: Minor
          Found in fannie/admin/labels/LikeCodeBatchSigns.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 getSignOpts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getSignOpts()
              {
                  $mods = FannieAPI::listModules('\COREPOS\Fannie\API\item\FannieSignage');
                  $enabled = $this->config->get('ENABLED_SIGNAGE');
                  if (count($enabled) > 0) {
          Severity: Minor
          Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 1 hr to fix

            Function post_edit_handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function post_edit_handler()
                {
                    $dbc = FannieDB::get($this->config->get('OP_DB'));
            
                    $upcs = array();
            Severity: Minor
            Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 45 mins 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 get_id_view has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function get_id_view()
                {
                    $query = 'SELECT * FROM batchList WHERE batchID=?';
                    if (!FormLib::get('all')) {
                        $query .= ' AND signMultiplier=0';
            Severity: Minor
            Found in fannie/admin/labels/LikeCodeBatchSigns.php - About 45 mins 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

            There are no issues that match your filters.

            Category
            Status