CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

        var myChart = new Chart(ctx3, {
            type: 'line',
            data: {
                labels: inp.labels,
                datasets: [
Severity: Major
Found in fannie/modules/plugins2.0/OpenBookFinancingV2/summary.js and 2 other locations - About 4 hrs to fix
fannie/modules/plugins2.0/OpenBookFinancingV2/summary.js on lines 10..37
fannie/modules/plugins2.0/OpenBookFinancingV2/summary.js on lines 41..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 131.

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

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

    Copyright 2013 Whole Foods Co-op

Severity: Minor
Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumLoanPayoffPage.php - About 4 hrs to fix

    File count.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    function loader(){
        $('#display').html('');
        var date1 = $('#startDate').val();
        var date2 = $('#endDate').val();
        var store = $('select[name=store]').val();
    Severity: Minor
    Found in fannie/modules/plugins2.0/OverShortTools/js/count.js - About 4 hrs to fix

      Method run has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run()
          {
              $dbc = CalendarPluginDB::get();
      
              /**

        File EOMReport.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        use COREPOS\Fannie\API\item\StandardAccounting;
        
        include(__DIR__ . '/../../../../config.php');
        Severity: Minor
        Found in fannie/modules/plugins2.0/CoreWarehouse/reports/EOMReport.php - About 4 hrs to fix

          File clearinghouse.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /*******************************************************************************
          
              Copyright 2010 Whole Foods Co-op
          
          
          Severity: Minor
          Found in fannie/ordering/clearinghouse.php - About 4 hrs to fix

            Method get_createBatch_view has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function get_createBatch_view()
                {
                    $i = FormLib::get('i');
                    $date1 = new DateTime();
                    $date2 = new DateTime();
            Severity: Major
            Found in fannie/item/RoundingFixerTool.php - About 4 hrs to fix

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

              for($i=0;$i<=count($current);$i++){
                  $c = isset($current[$i]) ? $current[$i] : '';
                  echo '<select name="RM_MODS[]">';
                  echo '<option value="">' . _('[None]') . '</option>';
                  foreach($available as $a) {
              Severity: Major
              Found in pos/is4c-nf/install/receipt.php and 1 other location - About 4 hrs to fix
              pos/is4c-nf/install/receipt.php on lines 278..289

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

              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<=count($current);$i++){
                  $c = isset($current[$i]) ? $current[$i] : '';
                  echo '<select name="NTH_MODS[]">';
                  echo '<option value="">' . _('[None]') . '</option>';
                  foreach($available as $a) {
              Severity: Major
              Found in pos/is4c-nf/install/receipt.php and 1 other location - About 4 hrs to fix
              pos/is4c-nf/install/receipt.php on lines 243..254

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

              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

              Function handle has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handle($upc,$json)
                  {
                      list($manId, $fam, $val, $manIdStart) = $this->upcToParts($upc);
              
                      $valueInfo = $this->getValue($val);
              Severity: Minor
              Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/CouponCode.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

              Function upload_content has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function upload_content()
                  {
                      $db = WfcHtLib::hours_dbconnect();
              
                      $ADP_COL = 3;
              Severity: Minor
              Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtUploadPage.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

              Function import has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  static public function import($filename, $vendorID, $repeat=false)
                  {
                      echo $filename . "\n";
                      global $FANNIE_OP_DB;
                      $dbc = FannieDB::get($FANNIE_OP_DB);
              Severity: Minor
              Found in fannie/modules/plugins2.0/UnfiInvoiceGrabber/MyUIGLib.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

              Function run has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function run()
                  {
                      $dbc = FannieDB::get($this->config->get('OP_DB'));
                      $settings = $this->config->get('PLUGIN_SETTINGS');
              
              
              Severity: Minor
              Found in fannie/modules/plugins2.0/Mercato/MercatoTask.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

              Function process_file has a Cognitive Complexity of 32 (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/mem/patronage/PatronageCheckNumbersUploadPage.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

              Function process_file has a Cognitive Complexity of 32 (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/mem/import/MemNameNumImportPage.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

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

                  function process_file($linedata, $indexes)
                  {
                      global $FANNIE_OP_DB;
                      $dbc = FannieDB::get($FANNIE_OP_DB);
              
              
              Severity: Minor
              Found in fannie/item/hobartcsv/ScaleItemUploadPage.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 Compare has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
              Open

                      internal static int Compare(JTokenType valueType, object objA, object objB)
                      {
                          if (objA == null && objB == null)
                              return 0;
                          if (objA != null && objB == 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 ParsePath has a Cognitive Complexity of 47 (exceeds 20 allowed). Consider refactoring.
              Open

                      private bool ParsePath(List<PathFilter> filters, int currentPartStartIndex, bool query)
                      {
                          bool scan = false;
                          bool followingIndexer = false;
                          bool followingDot = false;

              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

              function existingDates(dateStr)
              {
                  if (dateStr != '') {
                      var dates = dateStr.split(' ');
                      if (dates.length === 2) {
              Severity: Major
              Found in fannie/modules/plugins2.0/OverShortTools/js/countV2.js and 1 other location - About 4 hrs to fix
              fannie/modules/plugins2.0/OverShortTools/js/countV3.js on lines 271..283

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

              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

              function existingDates(dateStr)
              {
                  if (dateStr != '') {
                      var dates = dateStr.split(' ');
                      if (dates.length === 2) {
              Severity: Major
              Found in fannie/modules/plugins2.0/OverShortTools/js/countV3.js and 1 other location - About 4 hrs to fix
              fannie/modules/plugins2.0/OverShortTools/js/countV2.js on lines 267..279

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

              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