CORE-POS/IS4C

View on GitHub
fannie/purchasing/js/manual.js

Summary

Maintainability
F
3 days
Test Coverage

File manual.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function skuField(row, vendor_id)
{
    var sku = $('<input type="text" name="sku[]" required />')
        .addClass('form-control')
        .addClass('item-sku')
Severity: Minor
Found in fannie/purchasing/js/manual.js - About 2 hrs to fix

    Function doLookup has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function doLookup(mode, term, elem)
    {
        if (loading) {
            return;
        }
    Severity: Minor
    Found in fannie/purchasing/js/manual.js - About 1 hr to fix

      Function existingOrder has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function existingOrder(orderJSON, itemsJSON)
      {
          var order = JSON.parse(orderJSON);
          var items = JSON.parse(itemsJSON);
      
      
      Severity: Minor
      Found in fannie/purchasing/js/manual.js - About 1 hr to fix

        Function vendorAutoComplete has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function vendorAutoComplete(ws_url, field_name, search_term, vendor_id, callback)
        Severity: Minor
        Found in fannie/purchasing/js/manual.js - About 35 mins to fix

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

              var sku = $('<input type="text" name="sku[]" required />')
                  .addClass('form-control')
                  .addClass('item-sku')
                  .addClass('upc-field')
                  .addClass('input-sm')
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 1 other location - About 4 hrs to fix
          fannie/purchasing/js/manual.js on lines 23..37

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

          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

              var upc = $('<input type="text" name="upc[]" required />')
                  .addClass('form-control')
                  .addClass('item-upc')
                  .addClass('input-sm')
                  .addClass('upc-field')
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 1 other location - About 4 hrs to fix
          fannie/purchasing/js/manual.js on lines 3..17

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

          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

              $.ajax({
                  url: ws_url,
                  type: 'post',
                  data: JSON.stringify(req),
                  dataType: 'json',
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 1 other location - About 3 hrs to fix
          fannie/item/autocomplete.js on lines 12..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 102.

          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 qtyField(row)
          {
              var qty = $('<input type="text" name="cases[]" required />')
                  .val(1)
                  .addClass('input-sm')
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 1 other location - About 2 hrs to fix
          fannie/purchasing/js/manual.js on lines 56..64

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

          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 caseSizeField(row)
          {
              var caseSize = $('<input type="text" name="case-size[]" required />')
                  .val(1)
                  .addClass('item-units')
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 1 other location - About 2 hrs to fix
          fannie/purchasing/js/manual.js on lines 46..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 83.

          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

                      if (data.result.description !== '') {
                          elem.closest('tr').find('.item-description').val(data.result.description);
                      }
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 2 other locations - About 55 mins to fix
          fannie/purchasing/js/manual.js on lines 208..210
          fannie/purchasing/js/manual.js on lines 211..213

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

          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

                      if (data.result.brand !== '') {
                          elem.closest('tr').find('.item-brand').val(data.result.brand);
                      }
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 2 other locations - About 55 mins to fix
          fannie/purchasing/js/manual.js on lines 208..210
          fannie/purchasing/js/manual.js on lines 214..216

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

          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

                      if (data.result.units !== '') {
                          elem.closest('tr').find('.item-units').val(data.result.units);
                      }
          Severity: Major
          Found in fannie/purchasing/js/manual.js and 2 other locations - About 55 mins to fix
          fannie/purchasing/js/manual.js on lines 211..213
          fannie/purchasing/js/manual.js on lines 214..216

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

          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

              $.ajax({
                  url: '../ws/',
                  type: 'post',
                  data: JSON.stringify(req),
                  dataType: 'json',
          Severity: Minor
          Found in fannie/purchasing/js/manual.js and 2 other locations - About 40 mins to fix
          fannie/item/likecodes/skuMap.js on lines 13..23
          fannie/item/search.js on lines 94..111

          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