CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

    public function process_file($linedata, $indexes)
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Minor
Found in fannie/item/import/ProductImportPage.php - About 3 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 normalizeColumnAttributes has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    private function normalizeColumnAttributes($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
    {
        $current = $this->connection->detailedDefinition($this->name);
        $dbms = $this->connection->dbmsName();
        $recase_columns = array();
Severity: Minor
Found in common/BasicModel.php - About 3 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 voidid has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function voidid($itemNum, $json)
    {
        $row = $this->getLine($itemNum);

        $upc = $row["upc"];
Severity: Major
Found in pos/is4c-nf/parser/parse/VoidCmd.php - About 3 hrs to fix

    Method get has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    static public function get($session)
    {
        $DESIRED_TENDERS = is_array($session->get("TRDesiredTenders")) ? $session->get('TRDesiredTenders') : array();
    
        $DESIRED_TENDERS = array_merge($DESIRED_TENDERS, array(

      Method get_view has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_view()
          {
              $dbc = $this->connection;
              $dbc->selectDB($this->config->OP_DB);
      
      
      Severity: Major
      Found in fannie/batches/UNFI/VendorPricingBatchPage.php - About 3 hrs to fix

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

            function form_content()
            {
                $dbc = $this->connection;
                $dbc->selectDB($this->config->get('OP_DB'));
        
        
        Severity: Major
        Found in fannie/reports/BatchBeforeAfter/BatchBeforeAfterReport.php - About 3 hrs to fix

          Method printItems has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function printItems($items, $curPlu=false, $withCancel=true)
              {
                  $ret = '';
                  $i = 0;
                  $dbc = FannieDB::get($this->config->get('OP_DB'));
          Severity: Major
          Found in fannie/modules/plugins2.0/WfcClassRegistry/WfcClassRegistryPage.php - About 3 hrs to fix

            Method getFile has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getFile($filename)
                {
                    $csv = fopen($filename, 'w');
                    $query = '
                        SELECT p.upc,
            Severity: Major
            Found in fannie/modules/plugins2.0/InstaCart/InstaFileV2.php - About 3 hrs to fix

              Method drawItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function drawItem($pdf, $item, $row, $column)
                  {
                      $item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
                      $item['description'] = str_replace("  ", " ", $item['description']);
                      $effective_width = $this->width - (2*$this->left);
              Severity: Major
              Found in fannie/classlib2.0/item/signage/Signage16UpP.php - About 3 hrs to fix

                Method drawItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function drawItem($pdf, $item, $row, $column)
                    {
                        $item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
                        $item['description'] = str_replace("  ", " ", $item['description']);
                        $effective_width = $this->width - (2*$this->left);
                Severity: Major
                Found in fannie/classlib2.0/item/signage/Giganto4UpP.php - About 3 hrs to fix

                  Method drawItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function drawItem($pdf, $item, $row, $column)
                      {
                          $item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
                          $item['description'] = str_replace("  ", " ", $item['description']);
                          $effective_width = $this->width - (2*$this->left);
                  Severity: Major
                  Found in fannie/classlib2.0/item/signage/Compact16UpP.php - About 3 hrs to fix

                    Method drawItem has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function drawItem($pdf, $item, $row, $column)
                        {
                            $item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
                            $item['description'] = str_replace("  ", " ", $item['description']);
                            $effective_width = $this->width - (2*$this->left);
                    Severity: Major
                    Found in fannie/classlib2.0/item/signage/Compact4UpP.php - About 3 hrs to fix

                      Method process_file has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function process_file($linedata, $indexes)
                          {
                              global $FANNIE_OP_DB;
                              $dbc = FannieDB::get($FANNIE_OP_DB);
                      
                      
                      Severity: Major
                      Found in fannie/item/import/AdTextImportPage.php - About 3 hrs to fix

                        Method get_view has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function get_view()
                            {
                                $dbc = FannieDB::get($this->config->get('OP_DB'));
                                $model = new ShrinkReasonsModel($dbc);
                                $reasons = array(0 => 'n/a');
                        Severity: Major
                        Found in fannie/item/shrink/ShrinkEditor.php - About 3 hrs to fix

                          Method calculateMargin has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function calculateMargin($price, $cost, $deptID, $upc)
                              {
                                  $dbc = $this->db();
                          
                                  $desired_margin = 'Unknown';
                          Severity: Major
                          Found in fannie/item/modules/ItemMarginModule.php - About 3 hrs to fix

                            Method CalculateSize has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    private int CalculateSize(BsonToken t)
                                    {
                                        switch (t.Type)
                                        {
                                            case BsonType.Object:

                              Method ResolveReferences has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      private JsonSchema ResolveReferences(JsonSchema schema)
                                      {
                                          if (schema.DeferredReference != null)
                                          {
                                              string reference = schema.DeferredReference;

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

                                function sanitizeFieldQuoting($current_value)
                                {
                                    // quoted must not contain single quotes
                                    $current_value = str_replace("'", '', $current_value);
                                    // must not start with backslash
                                Severity: Major
                                Found in fannie/install/util.php and 1 other location - About 3 hrs to fix
                                pos/is4c-nf/install/conf/FormFactory.php on lines 284..298

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

                                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

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

                                    private function sanitizeString($current_value)
                                    {
                                        // quoted must not contain single quotes
                                        $current_value = str_replace("'", '', $current_value);
                                        // must not start with backslash
                                Severity: Major
                                Found in pos/is4c-nf/install/conf/FormFactory.php and 1 other location - About 3 hrs to fix
                                fannie/install/util.php on lines 330..344

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

                                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

                                File EpScaleLib.php has 294 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /*******************************************************************************
                                
                                    Copyright 2014 Whole Foods Co-op, Duluth, MN
                                
                                
                                Severity: Minor
                                Found in fannie/classlib2.0/item/EpScaleLib.php - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language