CORE-POS/IS4C

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

Summary

Maintainability
F
1 mo
Test Coverage

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

var rpOrder = (function ($) {

    var mod = {};
    var state = {
        'retention': 60,
Severity: Minor
Found in fannie/modules/plugins2.0/RP/rpOrder.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 440 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/rpOrder.js - About 2 days to fix

    File rpOrder.js has 442 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/rpOrder.js - About 6 hrs to fix

      Function updateDays has 50 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: Minor
      Found in fannie/modules/plugins2.0/RP/rpOrder.js - About 2 hrs to fix

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

            mod.initState = function(s) {
                if (typeof s == 'object') {
                    state = s;
                    if (state['onHand'].__proto__ == Array.prototype) {
                        state['onHand'] = {};
        Severity: Minor
        Found in fannie/modules/plugins2.0/RP/rpOrder.js - About 1 hr 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/rpOrder.js - About 1 hr to fix

            Function reCalcRow has 27 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 = $(elem).find('input.onHand').val();
                    if (onHand <= 0) {
            Severity: Minor
            Found in fannie/modules/plugins2.0/RP/rpOrder.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/rpOrder.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/rpOrder.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/rpOrder.js - About 1 hr to fix

                    Similar blocks of code found in 2 locations. 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/rpOrder.js and 1 other location - About 4 days to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 247..302

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

                    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.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/rpOrder.js and 1 other location - About 2 days to fix
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 460..498

                    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/rpOrder.js and 1 other location - About 2 days to fix
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 103..131

                    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/rpOrder.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/rpDual.js on lines 369..398
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 204..233

                    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/rpOrder.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/rpDual.js on lines 338..367
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 173..202

                    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/rpOrder.js and 1 other location - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 510..528

                    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/rpOrder.js and 1 other location - About 1 day to fix
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 23..44

                    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.onHandKey = 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/rpOrder.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/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 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.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/rpOrder.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/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

                    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/rpOrder.js and 3 other locations - About 6 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDirect.js on lines 231..245
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 211..225
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 104..118

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 172.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                        mod.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/rpOrder.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/rpDual.js on lines 328..336
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 163..171

                    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/rpOrder.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/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 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/rpOrder.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/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

                    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/rpOrder.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/rpDual.js on lines 77..85
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 26..34

                    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['onHand'][elemID]);
                                    mod.reCalcRow($(elem).closest('tr'));
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpOrder.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/rpDual.js on lines 176..181
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 76..81

                    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/rpOrder.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/rpDual.js on lines 69..75
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 18..24

                    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/rpOrder.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/rpDual.js on lines 500..507
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 319..326

                    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/rpOrder.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/rpDual.js on lines 46..56

                    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/rpOrder.js and 1 other location - About 2 hrs to fix
                    fannie/modules/plugins2.0/RP/rpDual.js on lines 530..535

                    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.onHand').each(function () {
                                $(this).attr('data-incoming', 0);
                                $(this).closest('td').find('span.incoming-notice').html('');
                            });
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpOrder.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/rpDual.js on lines 96..101

                    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.updateOnHand = function(elem) {
                            var onHand = state['onHand'];
                            onHand[elem.id] = elem.value;
                            state['onHand'] = onHand;
                            mod.save();
                    Severity: Major
                    Found in fannie/modules/plugins2.0/RP/rpOrder.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/rpDual.js on lines 204..209
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 97..102

                    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/rpOrder.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/rpDual.js on lines 87..94
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 36..43

                    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

                    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/rpOrder.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/rpDual.js on lines 149..154
                    fannie/modules/plugins2.0/RP/rpFloral.js on lines 67..72

                    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/rpOrder.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/rpDual.js on lines 58..62

                    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