CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

File JObject.cs has 470 lines of code (exceeds 250 allowed). Consider refactoring.
Open

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
#if !PORTABLE40
using System.Collections.Specialized;

    Function fetch_report_data has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fetch_report_data()
        {
            $class_lib = $this->class_lib;
            $dbc = $class_lib::getDB();
            
    Severity: Minor
    Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php - About 7 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 ShowEditForm has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        function ShowEditForm($memNum,$country="US",$inProgramID=-1)
        {
            global $FANNIE_URL;
            global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
    
    
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 7 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 PopulateMultidimensionalArray has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
    Open

            private object PopulateMultidimensionalArray(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, string id)
            {
                int rank = contract.UnderlyingType.GetArrayRank();
    
                if (id != null)

    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 ReadMetadataProperties has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
    Open

            private bool ReadMetadataProperties(JsonReader reader, ref Type objectType, ref JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue, out object newValue, out string id)
            {
                id = null;
                newValue = null;
    
    

    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

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

        protected function priceDiff($data)
        {
            usort($data, function($a, $b) {
                if ($a['nonSalePrice'] < $b['nonSalePrice']) {
                    return -1;
    Severity: Major
    Found in fannie/classlib2.0/item/signage/ItemList2UpP.php and 1 other location - About 7 hrs to fix
    fannie/classlib2.0/item/signage/ItemList4UpL.php on lines 43..69

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

    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

        protected function priceDiff($data)
        {
            usort($data, function($a, $b) {
                if ($a['nonSalePrice'] < $b['nonSalePrice']) {
                    return -1;
    Severity: Major
    Found in fannie/classlib2.0/item/signage/ItemList4UpL.php and 1 other location - About 7 hrs to fix
    fannie/classlib2.0/item/signage/ItemList2UpP.php on lines 42..68

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

    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

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

        protected function get_id_view()
        {
            try {
                $row = $this->getIncident($this->id);
            } catch (Exception $ex) {
    Severity: Major
    Found in fannie/modules/plugins2.0/IncidentTracker/AlertIncident.php - About 7 hrs to fix

      File LiabilityReport.php has 466 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /*******************************************************************************
      
          Copyright 2013 Whole Foods Co-op
      
      

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

            public function get_id_view()
            {
                $table = $this->getTable();
                $td = $table;
        
        
        Severity: Major
        Found in fannie/batches/UNFI/VPBPIII.php - About 7 hrs to fix

          Method standardItemFromWhere has 178 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static public function standardItemFromWhere()
              {
                  $op_db = FannieConfig::config('OP_DB');
                  $dbc = FannieDB::getReadOnly($op_db);
                  $start_date = self::getDate('date1', date('Y-m-d'));
          Severity: Major
          Found in fannie/classlib2.0/lib/FormLib.php - About 7 hrs to fix

            Function fetch_report_data has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
            Open

                function fetch_report_data(){
                    global $FANNIE_OP_DB, $FANNIE_COOP_ID;
                    $d1 = $this->form->date1;
                    $d2 = $this->form->date2;
                    $dept = FormLib::get_form_value('dept',0);
            Severity: Minor
            Found in fannie/reports/StoreSummary/StoreSummaryReportAlt.php - About 7 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 viewOrEdit has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
            Open

                private function viewOrEdit($emp)
                {
                    $canEdit = FannieAuth::validateUserQuiet('hr_editor');
                    $this->connection->selectDB($this->default_db);
                    $store = new StoresModel($this->connection);
            Severity: Minor
            Found in fannie/modules/plugins2.0/HrWeb/Employee/EmployeesPage.php - About 7 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 preprocess has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
            Open

                function preprocess(){
            
                    global $FANNIE_CORRECTION_CASHIER, $FANNIE_CORRECTION_LANE, $FANNIE_CORRECTION_DEPT;
                    global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS,$FANNIE_OP_DB;
            
            
            Severity: Minor
            Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredInputTool.php - About 7 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 SaveFormData has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
            Open

                function SaveFormData($upc)
                {
                    /* check if data was submitted */
                    if (FormLib::get('s_plu') === '') return False;
            
            
            Severity: Minor
            Found in fannie/item/modules/ScaleItemModule.php - About 7 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 ProcessEMV has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
            Open

                protected string ProcessEMV(string xml, bool autoReset)
                {
                    /* 
                       Substitute values into the XML request
                       This is so the driver can handle any change
            Severity: Minor
            Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Datacap_EMVX.cs - About 7 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 createTransDBs has 177 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function createTransDBs($db, $name)
                {
                    $errors = array();
                    $type = $db->dbmsName();
            
            
            Severity: Major
            Found in pos/is4c-nf/install/db/Creator.php - About 7 hrs to fix

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

                  foreach($data as $k => $row){
                      $upc = $row['upc'];
                      if ($i % 24 == 0 && $i != 0) {
                          $pdf->AddPage('L');
                          $x = $left;
              Severity: Major
              Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Extended_24UP.php and 2 other locations - About 7 hrs to fix
              fannie/admin/labels/pdf_layouts/WFC_Deli_Narrow_24UP.php on lines 56..74
              fannie/admin/labels/pdf_layouts/WFC_Deli_Short_24UP.php on lines 57..75

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

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

                  foreach($data as $k => $row){
                      $upc = $row['upc'];
                      if ($i % 24 == 0 && $i != 0) {
                          $pdf->AddPage('L');
                          $x = $left;
              Severity: Major
              Found in fannie/admin/labels/pdf_layouts/WFC_Deli_Short_24UP.php and 2 other locations - About 7 hrs to fix
              fannie/admin/labels/pdf_layouts/WFC_Dark_Extended_24UP.php on lines 52..70
              fannie/admin/labels/pdf_layouts/WFC_Deli_Narrow_24UP.php on lines 56..74

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

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

                  foreach($data as $k => $row){
                      $upc = $row['upc'];
                      if ($i % 30 == 0 && $i != 0) {
                          $pdf->AddPage('L');
                          $x = $left;
              Severity: Major
              Found in fannie/admin/labels/pdf_layouts/WFC_Deli_Narrow_24UP.php and 2 other locations - About 7 hrs to fix
              fannie/admin/labels/pdf_layouts/WFC_Dark_Extended_24UP.php on lines 52..70
              fannie/admin/labels/pdf_layouts/WFC_Deli_Short_24UP.php on lines 57..75

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

              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

              Severity
              Category
              Status
              Source
              Language