CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/RP/rpDual.js

Summary

Maintainability
F
1 mo
Test Coverage

Function rpOrder has a Cognitive Complexity of 143 (exceeds 5 allowed). Consider refactoring.
Open

var rpOrder = (function ($) {

    var mod = {};
    var state = {
        'retention': 60,
Severity: Minor
Found in fannie/modules/plugins2.0/RP/rpDual.js - About 2 days 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 rpOrder has 490 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var rpOrder = (function ($) {

    var mod = {};
    var state = {
        'retention': 60,
Severity: Major
Found in fannie/modules/plugins2.0/RP/rpDual.js - About 2 days to fix

    File rpDual.js has 492 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var rpOrder = (function ($) {
    
        var mod = {};
        var state = {
            'retention': 60,
    Severity: Minor
    Found in fannie/modules/plugins2.0/RP/rpDual.js - About 7 hrs to fix

      Function initState has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          mod.initState = function(s) {
              if (typeof s == 'object') {
                  state = s;
                  if (state['onHand1'].__proto__ == Array.prototype) {
                      state['onHand1'] = {};
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpDual.js - About 2 hrs to fix

        Function updateDays has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            mod.updateDays = function() {
                clearIncoming();
                var week = $('#modProj').html();
                if (week == 0) {
                    week = $('#projSales').html().replace(',', '');
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/rpDual.js - About 2 hrs to fix

          Function placeOrder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              mod.placeOrder = function(elem) {
                  var id = encodeURIComponent($(elem).val());
                  var qty = $(elem).closest('tr').find('input.orderAmt').val();
                  if ($(elem).prop('checked') && qty) {
                      $.ajax({
          Severity: Minor
          Found in fannie/modules/plugins2.0/RP/rpDual.js - About 1 hr to fix

            Function reCalcRow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                mod.reCalcRow = function(elem) {
                    var caseSize = $(elem).find('td.caseSize').html();
                    var adj = $(elem).find('td.parCell').html();
                    var onHand = 1 * $(elem).find('input.onHand1').val();
                    onHand += (1 * $(elem).find('input.onHand2').val());
            Severity: Minor
            Found in fannie/modules/plugins2.0/RP/rpDual.js - About 1 hr to fix

              Function nextRow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function nextRow(elem) {
                      var myRow = $(elem).closest('tr');
                      var limit = 0;
                      while (true) {
                          var next = $(myRow).next('tr');
              Severity: Minor
              Found in fannie/modules/plugins2.0/RP/rpDual.js - About 1 hr to fix

                Function prevRow has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function prevRow(elem) {
                        var myRow = $(elem).closest('tr');
                        var limit = 0;
                        while (true) {
                            var prev = $(myRow).prev('tr');
                Severity: Minor
                Found in fannie/modules/plugins2.0/RP/rpDual.js - About 1 hr to fix

                  Function getIncoming has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function getIncoming(min, max) {
                          var store = $('select[name=store]').val();
                          $.ajax({
                              type: 'get',
                              data: 'date1='+min+'&date2='+max+'&store='+store,
                  Severity: Minor
                  Found in fannie/modules/plugins2.0/RP/rpDual.js - About 1 hr to fix

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

                        mod.placeOrder = function(elem) {
                            var id = encodeURIComponent($(elem).val());
                            var qty = $(elem).closest('tr').find('input.orderAmt').val();
                            if ($(elem).prop('checked') && qty) {
                                $.ajax({
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 2 days to fix
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 406..444

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

                    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

                        function getIncoming(min, max) {
                            var store = $('select[name=store]').val();
                            $.ajax({
                                type: 'get',
                                data: 'date1='+min+'&date2='+max+'&store='+store,
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 2 days to fix
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 101..129

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

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

                        function prevRow(elem) {
                            var myRow = $(elem).closest('tr');
                            var limit = 0;
                            while (true) {
                                var prev = $(myRow).prev('tr');
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 377..406
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 204..233
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 337..366

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

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

                        function nextRow(elem) {
                            var myRow = $(elem).closest('tr');
                            var limit = 0;
                            while (true) {
                                var next = $(myRow).next('tr');
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 346..375
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 173..202
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 306..335

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

                    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

                        mod.onHand2Key = function(ev) {
                            if (ev.which == 13 || ev.which == 40) {
                                ev.preventDefault();
                                var next = nextRow(ev.target);
                                if (next) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 2 other locations - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 427..447
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 254..274

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

                    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

                        mod.orderAll = function() {
                            var buttons = $('button.orderAll');
                            var meters = $('.progress');
                            buttons.prop('disabled', true);
                            meters.show();
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 456..474

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

                    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

                        mod.initAutoCompletes = function() {
                            $('input#newItem').autocomplete({
                                source: vendorAutoComplete,
                                select: function (ev, ui) {
                                    ev.preventDefault();
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 21..42

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

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

                        mod.orderKey = function(ev) {
                            if (ev.which == 13 || ev.which == 40) {
                                ev.preventDefault();
                                var next = nextRow(ev.target);
                                if (next) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 6 other locations - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 408..425
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 449..466
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 400..417
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 235..252
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 368..385
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 387..404

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

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

                        mod.onHand1Key = function(ev) {
                            if (ev.which == 13 || ev.which == 40) {
                                ev.preventDefault();
                                var next = nextRow(ev.target);
                                if (next) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 6 other locations - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 408..425
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 449..466
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 441..458
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 235..252
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 368..385
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 387..404

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

                    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.inc = function(btn, amt) {
                            var elem = $(btn).parent().find('input.orderAmt');
                            var next = ($(elem).val() * 1) + amt;
                            if (next < 0) {
                                next = 0;
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 336..344
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 163..171
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 296..304

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

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

                                for (i=0; i<oIDs.length; i++) {
                                    var elemID = oIDs[i];
                                    if (state['orderAmt'][elemID] !== '') {
                                        var field = document.getElementById(elemID);
                                        if (field) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 6 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 157..165
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 198..206
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 158..166
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 84..92
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 153..161
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 172..180

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

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

                                for (i=0; i<oIDs.length; i++) {
                                    var elemID = oIDs[i];
                                    if (state['orderAmt'][elemID] !== '') {
                                        var field = document.getElementById(elemID);
                                        if (field) {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 6 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 157..165
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 198..206
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 184..192
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 84..92
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 153..161
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 172..180

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

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

                        mod.save = function() {
                            $.ajax({
                                type: 'post',
                                data: 'json=' + encodeURIComponent(JSON.stringify(state))
                            }).done(function() {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 75..83
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 26..34
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 75..83

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

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

                                for (i=0; i<hIDs.length; i++) {
                                    var elemID = hIDs[i];
                                    var elem = $('#'+elemID);
                                    $(elem).val(state['onHand1'][elemID]);
                                    mod.reCalcRow($(elem).closest('tr'));
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 4 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 168..173
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 176..181
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 76..81
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 164..169

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

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

                                for (i=0; i<hIDs.length; i++) {
                                    var elemID = hIDs[i];
                                    var elem = $('#'+elemID);
                                    $(elem).val(state['onHand2'][elemID]);
                                    mod.reCalcRow($(elem).closest('tr'));
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 4 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 168..173
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 169..174
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 76..81
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 164..169

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

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

                        function updateState() {
                            state['retention'] = $('#retention').val();
                            state['days'] = [];
                            $('.daycheck').each(function () {
                                state['days'].push($(this).prop('checked') ? true : false);
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 3 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 67..73
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 18..24
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 67..73

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

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

                        function endOrderAll(count, meters, buttons) {
                            if (count > 15 || mod.all <= 0) {
                                meters.hide();
                                buttons.prop('disabled', false);
                            } else {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 2 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 520..527
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 319..326
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 446..453

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

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

                        function ajaxAutoComplete(dstr, callback) {
                            $.ajax({
                                type: 'get',
                                data: dstr,
                                dataType: 'json'
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 2 other locations - About 2 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 44..54
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 44..54

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

                    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

                        mod.vendorFilter = function() {
                            $('tr.item-row').hide();
                            $('input.vFilter:checked').each(function () {
                                $('tr.vendor-' + $(this).val()).show();
                            });
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 1 other location - About 2 hrs to fix
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 476..481

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

                    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

                        function clearIncoming() {
                            $('input.onHand2').each(function () {
                                $(this).attr('data-incoming', 0);
                                $(this).closest('td').find('span.incoming-notice').html('');
                            });
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 2 other locations - About 2 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 94..99
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 94..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 75.

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

                        mod.updateOnHand1 = function(elem) {
                            var onHand = state['onHand1'];
                            onHand[elem.id] = elem.value;
                            state['onHand1'] = onHand;
                            mod.save();
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 4 other locations - About 1 hr to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 224..229
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 204..209
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 97..102
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 185..190

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

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

                        mod.updateOnHand2 = function(elem) {
                            var onHand = state['onHand2'];
                            onHand[elem.id] = elem.value;
                            state['onHand2'] = onHand;
                            mod.save();
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 4 other locations - About 1 hr to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 224..229
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 197..202
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 97..102
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 185..190

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

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

                        function saveLoop() {
                            $.ajax({
                                type: 'get',
                                data: 'json=' + encodeURIComponent(JSON.stringify(state))
                            }).always(function() {
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 1 hr to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 85..92
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 36..43
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 85..92

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

                    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 state = {
                            'retention': 60,
                            'days': [false, false, false, false, false, false, false],
                            'onHand1': {},
                            'onHand2': {},
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 2 other locations - About 1 hr to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 4..13
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 4..13

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

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

                                $('.daycheck').each(function() {
                                    if (state['days'][i]) {
                                        $(this).prop('checked', true);
                                    }
                                    i++;
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 1 hr to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 148..153
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 67..72
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 144..149

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

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

                        function vendorAutoComplete(req, callback) {
                            var dstr = 'searchVendor=' + encodeURIComponent(req.term);
                            dstr += '&vendorID=' + searchVendor;
                            ajaxAutoComplete(dstr, callback);
                        };
                    Severity: Minor
                    Found in fannie/modules/plugins2.0/RP/rpDual.js and 2 other locations - About 40 mins to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 56..60
                    fannie/modules/plugins2.0/RP/rpOrder.js on lines 56..60

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status