CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

File OverShortSafecountV2.php has 455 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php - About 6 hrs to fix

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

        function process_file($linedata, $indexes)
        {
            global $FANNIE_OP_DB;
            $dbc = FannieDB::get($FANNIE_OP_DB);
            $VENDOR_ID = $this->getVendorID();
    Severity: Minor
    Found in fannie/batches/UNFI/load-classes/CpwUploadPage.php - About 6 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 body_content has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        function body_content(){
            global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
            $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
            $periodID = FormLib::get_form_value('periodID',False);
            $emp_no = FormLib::get_form_value('emp_no',False);
    Severity: Minor
    Found in fannie/modules/plugins2.0/TimesheetPlugin/PayrollDetail.php - About 6 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 displayCashier has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        function displayCashier($date,$empno,$mode)
        {
            global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
            $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
            $store = FormLib::get('store', 1);
    Severity: Minor
    Found in fannie/modules/plugins2.0/OverShortTools/OverShortCashierPage.php - About 6 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 settingChange has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public function settingChange()
        {
            global $FANNIE_PLUGIN_SETTINGS;
    
            /* Would like to accumulate problems here
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopCred/CoopCred.php - About 6 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 EndObject has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
    Open

            private void EndObject(object newObject, JsonReader reader, JsonObjectContract contract, int initialDepth, Dictionary<JsonProperty, PropertyPresence> propertiesPresence)
            {
                if (propertiesPresence != null)
                {
                    foreach (KeyValuePair<JsonProperty, PropertyPresence> propertyPresence in propertiesPresence)

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

        private string ParseData(string s)
        {
            if (s.Substring(0,2) == "S0") { // scanner message
                if (s.Substring(0,4) == "S08A" || s.Substring(0,4) == "S08F") { // UPC-A or EAN-13
                    return s.Substring(4);
    Severity: Minor
    Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Magellan_Scale.cs - About 6 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 Read has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
    Open

        public override void Read()
        { 
            ReInitDevice();
            RBA_Stub emailRBA = null;
            if (device_identifier.Contains("INGENICO")) {
    Severity: Minor
    Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Datacap_EMVX.cs - About 6 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 ParseData has a Cognitive Complexity of 60 (exceeds 20 allowed). Consider refactoring.
    Open

        private string ParseData(string s)
        {
            if (s.Substring(0,1) == "0") { // scanner message
                if (s.Substring(0,3) == "08A" || s.Substring(0,3) == "08F") { // UPC-A or EAN-13
                    return s.Substring(3);
    Severity: Minor
    Found in pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_NCR_Scale.cs - About 6 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 172 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function body_content()
        {
            include(dirname(__FILE__) . '/../config.php'); 
            ob_start();
            ?>
    Severity: Major
    Found in fannie/install/InstallMenuPage.php - About 6 hrs to fix

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

          protected function get_id_view()
          {
              $ts = strtotime($this->id);
              $startID = date('Ymd', $ts);
              $endID = date('Ymd', mktime(0,0,0,date('m',$ts),date('j',$ts)+6,date('Y',$ts)));
      Severity: Major
      Found in fannie/modules/plugins2.0/CoreWarehouse/reports/WfcWeeklyReport.php - About 6 hrs to fix

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

                    for($i=0; $i<7; $i++) {
                        $entry_ts = mktime($hour, 0, 0, date('n', $startTS), date('j', $startTS)+$i, date('Y', $startTS));
                        if ($EDIT) {
                            $ret .= sprintf('<td id="weekEntry%d" class="weekEntry"
                                            onclick="weekClickCallback(%d);"
        fannie/modules/plugins2.0/CalendarPlugin/CalendarPluginDisplayLib.php on lines 349..373

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

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

                    for($i=0; $i<7; $i++) {
                        $entry_ts = mktime($hour, 30, 0, date('n', $startTS), date('j', $startTS)+$i, date('Y', $startTS));
                        if ($EDIT) {
                            $ret .= sprintf('<td id="weekEntry%d" class="weekEntry"
                                            onclick="weekClickCallback(%d);"
        fannie/modules/plugins2.0/CalendarPlugin/CalendarPluginDisplayLib.php on lines 321..345

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

        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 RpImport.php has 453 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        include(__DIR__ . '/../../../config.php');
        if (!class_exists('FannieAPI')) {
            include(__DIR__ . '/../../../classlib2.0/FannieAPI.php');
        Severity: Minor
        Found in fannie/modules/plugins2.0/RP/RpImport.php - About 6 hrs to fix

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

              mod.updateOrder = function(elem) {
                  state['orderAmt'][elem.id] = elem.value;
                  mod.save();
                  var inOrder = $(elem).closest('tr').find('input:checked');
                  if (inOrder.length > 0) {
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/rpOrder.js and 3 other locations - About 6 hrs to fix
          fannie/modules/plugins2.0/RP/rpDirect.js on lines 231..245
          fannie/modules/plugins2.0/RP/rpDual.js on lines 211..225
          fannie/modules/plugins2.0/RP/rpFloral.js on lines 104..118

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

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

              mod.updateOrder = function(elem) {
                  state['orderAmt'][elem.id] = elem.value;
                  mod.save();
                  var inOrder = $(elem).closest('tr').find('input:checked');
                  if (inOrder.length > 0) {
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 6 hrs to fix
          fannie/modules/plugins2.0/RP/rpDirect.js on lines 231..245
          fannie/modules/plugins2.0/RP/rpFloral.js on lines 104..118
          fannie/modules/plugins2.0/RP/rpOrder.js on lines 192..206

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

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

              mod.updateOrder = function(elem) {
                  state['floralAmt'][elem.id] = elem.value;
                  mod.save();
                  var inOrder = $(elem).closest('tr').find('input:checked');
                  if (inOrder.length > 0) {
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/rpFloral.js and 3 other locations - About 6 hrs to fix
          fannie/modules/plugins2.0/RP/rpDirect.js on lines 231..245
          fannie/modules/plugins2.0/RP/rpDual.js on lines 211..225
          fannie/modules/plugins2.0/RP/rpOrder.js on lines 192..206

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

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

              mod.updateOrder = function(elem) {
                  state['directAmt'][elem.id] = elem.value;
                  mod.save();
                  var inOrder = $(elem).closest('tr').find('input:checked');
                  if (inOrder.length > 0) {
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/rpDirect.js and 3 other locations - About 6 hrs to fix
          fannie/modules/plugins2.0/RP/rpDual.js on lines 211..225
          fannie/modules/plugins2.0/RP/rpFloral.js on lines 104..118
          fannie/modules/plugins2.0/RP/rpOrder.js on lines 192..206

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

          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

          Class NativeMethods has 49 methods (exceeds 20 allowed). Consider refactoring.
          Open

              static class NativeMethods
              {
                  const string CoreFoundation = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation";
                  const string CoreServices = "/System/Library/Frameworks/CoreServices.framework/CoreServices";
                  const string IOKit = "/System/Library/Frameworks/IOKit.framework/IOKit";

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

            <?php
            /*******************************************************************************
            
                Copyright 2014 Whole Foods Co-op
            
            
            fannie/modules/plugins2.0/OpenBookFinancing/OpenBookFinancing.php on lines 1..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 221.

            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