CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

function renameCategory(category){
    var curName = document.getElementById('category'+category).innerHTML;
    var clearName =  curName.replace(/_/,' ');
    var form = "<input type=text id=renameCategory"+category+" value=\""+clearName+"\" />";
    var link = " (<a href=\"\" onclick=\"saveCategory('"+category+"'); return false;\">Save</a>)";
Severity: Major
Found in fannie/modules/plugins2.0/DeliInventory/index3.js and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/DeliInventory/index.js on lines 126..133

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

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 renameCategory(category){
    var curName = document.getElementById('category'+category).innerHTML;
    var clearName =  curName.replace(/_/,' ');
    var form = "<input type=text id=renameCategory"+category+" value=\""+clearName+"\" />";
    var link = " (<a href=\"\" onclick=\"saveCategory('"+category+"'); return false;\">Save</a>)";
Severity: Major
Found in fannie/modules/plugins2.0/DeliInventory/index.js and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/DeliInventory/index3.js on lines 126..133

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

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

        if ($dtax > 0) {
            $fix1P = $this->connection->prepare("UPDATE " . FannieDB::fqn('dlog_15', 'trans') . "
                SET regPrice=?
                WHERE tdate BETWEEN ? AND ?
                    AND emp_no=?
Severity: Major
Found in fannie/modules/plugins2.0/Mercato/MercatoCorrections2.php and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/Mercato/MercatoCorrections2.php on lines 106..143

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

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

        if ($rtax > 0) {
            $fix1P = $this->connection->prepare("UPDATE " . FannieDB::fqn('dlog_15', 'trans') . "
                SET regPrice=?
                WHERE tdate BETWEEN ? AND ?
                    AND emp_no=?
Severity: Major
Found in fannie/modules/plugins2.0/Mercato/MercatoCorrections2.php and 1 other location - About 4 hrs to fix
fannie/modules/plugins2.0/Mercato/MercatoCorrections2.php on lines 145..184

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

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 createViews has 121 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createViews($dstr,$db){
    global $FANNIE_SERVER_DBMS, $FANNIE_ARCHIVE_REMOTE,
        $FANNIE_ARCHIVE_DBMS, $FANNIE_ARCHIVE_DB,
        $FANNIE_SERVER,$FANNIE_SERVER_PW,$FANNIE_SERVER_USER,
        $FANNIE_ARCHIVE_SERVER,$FANNIE_ARCHIVE_USER,
Severity: Major
Found in fannie/cron/nightly.dtrans.php - About 4 hrs to fix

    Method generateNewDeliNarrow_24UPTag has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function generateNewDeliNarrow_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $showBarcode, $offset)
    {
        $upc = $row['upc'];
        $desc = $row['description'];
        $brand = $row['brand'];
    Severity: Major
    Found in fannie/admin/labels/pdf_layouts/New_WFC_Deli_Narrow.php - About 4 hrs to fix

      Method generateNewDeliShort_24UPTag has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generateNewDeliShort_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $showBarcode,  $offset)
      {
          $upc = $row['upc'];
          $desc = $row['description'];
          $brand = $row['brand'];
      Severity: Major
      Found in fannie/admin/labels/pdf_layouts/New_WFC_Deli_Short.php - About 4 hrs to fix

        Method HandleMessageFromDevice has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void HandleMessageFromDevice(byte[] buffer)
            {
                System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
                if (this.verbose_mode > 0) {
                    System.Console.WriteLine("Received:");

          MemberREST has 37 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MemberREST
          {
              private static $FIELD_INFO = array(
                  'cardNo' => array('map'=>'CardNo', 'match'=>'strict'),
                  'memberStatus' => array('map'=>'Type', 'match'=>'strict'),
          Severity: Minor
          Found in fannie/classlib2.0/member/MemberREST.php - About 4 hrs to fix

            Class JsonSerializerInternalWriter has 37 methods (exceeds 20 allowed). Consider refactoring.
            Open

                internal class JsonSerializerInternalWriter : JsonSerializerInternalBase
                {
                    private JsonContract _rootContract;
                    private int _rootLevel;
                    private readonly List<object> _serializeStack = new List<object>();

              File GumPromissoryPage.php has 368 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*******************************************************************************
              
                  Copyright 2014 Whole Foods Co-op
              
              
              Severity: Minor
              Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumPromissoryPage.php - About 4 hrs to fix

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

                    protected function get_print_view()
                    {
                        $catP = $this->connection->prepare("SELECT name FROM DeliCategories WHERE deliCategoryID=?");
                        $name = $this->connection->getValue($catP, array($this->print));
                        $itemP = $this->connection->prepare("SELECT i.*, v.vendorName
                Severity: Major
                Found in fannie/modules/plugins2.0/DeliInventory/DIPage.php and 1 other location - About 4 hrs to fix
                fannie/modules/plugins2.0/DeliInventory/DIPage2.php on lines 286..327

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

                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 get_print_view()
                    {
                        $catP = $this->connection->prepare("SELECT name FROM DeliCategories WHERE deliCategoryID=?");
                        $name = $this->connection->getValue($catP, array($this->print));
                        $itemP = $this->connection->prepare("SELECT i.*, v.vendorName
                Severity: Major
                Found in fannie/modules/plugins2.0/DeliInventory/DIPage2.php and 1 other location - About 4 hrs to fix
                fannie/modules/plugins2.0/DeliInventory/DIPage.php on lines 281..322

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

                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

                    protected function post_newItem_handler()
                    {
                        $storeID = Store::getIdByIp();
                        $storeID=1;
                        $catP = $this->connection->prepare("SELECT name FROM DeliCategories WHERE deliCategoryID=?");
                Severity: Major
                Found in fannie/modules/plugins2.0/DeliInventory/DIPage.php and 1 other location - About 4 hrs to fix
                fannie/modules/plugins2.0/DeliInventory/DIPage2.php on lines 96..119

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

                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

                    protected function post_newItem_handler()
                    {
                        $storeID = Store::getIdByIp();
                        $storeID=2;
                        $catP = $this->connection->prepare("SELECT name FROM DeliCategories WHERE deliCategoryID=?");
                Severity: Major
                Found in fannie/modules/plugins2.0/DeliInventory/DIPage2.php and 1 other location - About 4 hrs to fix
                fannie/modules/plugins2.0/DeliInventory/DIPage.php on lines 96..119

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

                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 manageComments has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var manageComments = (function($) {
                
                    var mod = {};
                
                    mod.sendMsg = function() {
                Severity: Major
                Found in fannie/modules/plugins2.0/CommentTracker/js/manageComments.js - About 4 hrs to fix

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

                      public function get_view()
                      {
                          global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB, $FANNIE_TRANS_DB;
                          $this->addScript('js/accounts.js?changed=20180104');
                          $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['StaffArPayrollDB']);

                    Method CreateObject has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            private object CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue)
                            {
                                string id;
                                Type resolvedObjectType = objectType;
                    
                    

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

                              var myChart = new Chart(ctx2, {
                                  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 72..99

                      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

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

                              var myChart = new Chart(ctx, {
                                  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 41..68
                      fannie/modules/plugins2.0/OpenBookFinancingV2/summary.js on lines 72..99

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language