noobling/anglicare-sprint-week

View on GitHub
public/javascripts/service.js

Summary

Maintainability
F
1 mo
Test Coverage

File service.js has 799 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var bedIndex = 0;
Severity: Major
Found in public/javascripts/service.js - About 1 day to fix

    Function createImages has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function createImages(uri, logo, images) {
      var isIE = false;
      var ua = window.navigator.userAgent;
      var msie = ua.indexOf("MSIE ");
    
    
    Severity: Major
    Found in public/javascripts/service.js - About 2 hrs to fix

      Function updateRequests has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function updateRequests() {
        $('#updateRequests > .form-group').html('');
        $('#updateRequests > .form-group').hide();
        $('#spinnerLoadRequests').show();
        $.get('/service/dashboard/' + $('#uri').text() + '/requests/show', function (data) {
      Severity: Minor
      Found in public/javascripts/service.js - About 1 hr to fix

        Function createImages has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function createImages(uri, logo, images) {
          var isIE = false;
          var ua = window.navigator.userAgent;
          var msie = ua.indexOf("MSIE ");
        
        
        Severity: Minor
        Found in public/javascripts/service.js - About 1 hr 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 addPagination has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function addPagination(name, services) {
          var numSegments = 1;
          var numAdded = 0;
        
          for (var i = 0; i < services.length; i++) {
        Severity: Minor
        Found in public/javascripts/service.js - About 1 hr to fix

          Function addPagination has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function addPagination(name, services) {
            var numSegments = 1;
            var numAdded = 0;
          
            for (var i = 0; i < services.length; i++) {
          Severity: Minor
          Found in public/javascripts/service.js - About 45 mins 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

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

          $('a[href="#serviceProfile"]').on('click', function () {
            $('#addServiceForm').hide();
            $('#spinnerLoadProfile').show();
            $.get('/service/dashboard/' + $('#uri').text() + '/profile', function (data) {
              $('#serveName').val(data.service.name);
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 4 days to fix
          public/javascripts/src/service.js on lines 491..540

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

          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 updateRequests() {
            $('#updateRequests > .form-group').html('');
            $('#updateRequests > .form-group').hide();
            $('#spinnerLoadRequests').show();
            $.get('/service/dashboard/' + $('#uri').text() + '/requests/show', function (data) {
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 3 days to fix
          public/javascripts/src/service.js on lines 166..217

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

          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

          $('#photoSpace').on('click', '[id^=deleteimagebutton-image]', function (event) {
            event.preventDefault();
          
            var $element = $(this);
          
          
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 3 days to fix
          public/javascripts/src/service.js on lines 792..838

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

          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 createImages(uri, logo, images) {
            var isIE = false;
            var ua = window.navigator.userAgent;
            var msie = ua.indexOf("MSIE ");
          
          
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 2 days to fix
          public/javascripts/src/service.js on lines 542..600

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

          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

          $('#logoSpace').on('click', '[id^=deleteimagebutton-image]', function (event) {
            event.preventDefault();
          
            var $element = $(this);
          
          
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 2 days to fix
          public/javascripts/src/service.js on lines 668..707

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

          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 updateBeds() {
            $('#updateBeds > .form-group').html('');
            $('#updateBeds > .form-group').hide();
            $('#spinnerLoadBeds').show();
            $.get('/service/dashboard/' + $('#uri').text() + '/beds/show', function (data) {
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 120..141

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

          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

                success: function success(data) {
                  if (!data.error) {
                    // File upload successful - change the images mediaLink to the thumbnail and modal
                    toggleInputs();
          
          
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 742..776

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

          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

          $('#bedForm').submit(function (event) {
            event.preventDefault();
            var submit_button = $(this).find(':submit');
            var spinner = $(this).find('#spinnerConfirmBeds');
            submit_button.hide(100);
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 42..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 242.

          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

          $('#updateRequests').submit(function (event) {
            event.preventDefault();
            var submit_button = $(this).find(':submit');
            var spinner = $(this).find('#spinnerUpdateRequests');
          
          
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 219..241

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

          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

          $('#updateBeds').submit(function (event) {
            event.preventDefault();
            var submit_button = $(this).find(':submit');
            var spinner = $(this).find('#spinnerUpdateBeds');
          
          
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 143..164

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

          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

              success: function success(data) {
                if (!data.error) {
                  toggleInputs();
          
                  $element.closest('div[data=addImage]').hide(500, function () {
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 632..653

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

          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 formatDiff(diff, locale, defaultLocale) {
              // if locale is not exist, use defaultLocale.
              // if defaultLocale is not exist, use build-in `en`.
              // be sure of no error when locale is not exist.
              locale = locales[locale] ? locale : locales[defaultLocale] ? defaultLocale : 'en';
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 day to fix
          public/javascripts/src/service.js on lines 1060..1078

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

          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

              success: function success(data) {
                for (var i = 0; i < data.service.beds.length; i++) {
                  var bed = data.service.beds[i];
                  $('#bedList').append(BedPanel({
                    index: bedIndex,
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 7 hrs to fix
          public/javascripts/src/service.js on lines 11..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 180.

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

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

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

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

          Refactorings

          Further Reading

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

            function toDate(input) {
              if (input instanceof Date) return input;
              if (!isNaN(input)) return new Date(toInt(input));
              if (/^\d+$/.test(input)) return new Date(toInt(input));
              input = (input || '').trim().replace(/\.\d+/, '') // remove milliseconds
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 6 hrs to fix
          public/javascripts/src/service.js on lines 1045..1054

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

          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

            Timeago.prototype.doRender = function (node, date, locale) {
              var diff = diffSec(date, this.nowDate),
                  self = this,
                  tid;
              // delete previously assigned timeout's id to node
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 6 hrs to fix
          public/javascripts/src/service.js on lines 1143..1156

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

          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

            $('#updateNoteBtn' + index).click(function () {
              var data = {
                '_id': $('#requestId' + index).text(),
                'note': $('#requestNote' + index).val()
              };
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 5 hrs to fix
          public/javascripts/service.js on lines 288..301

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

          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

            $('#closedUpdateNoteBtn' + index).click(function () {
              var data = {
                '_id': $('#closedRequestId' + index).text(),
                'note': $('#closedRequestNote' + index).val()
              };
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 5 hrs to fix
          public/javascripts/service.js on lines 260..273

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

          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 sendData(data) {
            var submit_button = $(data).find(':submit');
          
            var post_url = $(data).attr("action"); //get form action url
            var request_method = $(data).attr("method"); //get form GET/POST method
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 5 hrs to fix
          public/javascripts/src/service.js on lines 243..257

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

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

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

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

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

          Refactorings

          Further Reading

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

          function toggleInputs() {
            $('#photoUploadRow').find('input:file').each(function () {
              $(this).prop('disabled', function (i, v) {
                return !v;
              });
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 5 hrs to fix
          public/javascripts/src/service.js on lines 844..852

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

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

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

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

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

          Refactorings

          Further Reading

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

            function nextInterval(diff) {
              var rst = 1,
                  i = 0,
                  d = Math.abs(diff);
              for (; diff >= SEC_ARRAY[i] && i < SEC_ARRAY_LEN; i++) {
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 4 hrs to fix
          public/javascripts/src/service.js on lines 1093..1103

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 130.

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

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

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

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

          Refactorings

          Further Reading

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

                error: function error(jqXHR, textStatus, errorThrown) {
                  // If the response contained an error, print the error in the alert box
                  if (jqXHR.responseText.indexOf("File too large") !== -1) {
                    $('#alertBox').html("<strong>File too large!</strong> Maximum file size is 2MB").show('slide');
                  } else {
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 4 hrs to fix
          public/javascripts/service.js on lines 528..538

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

          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

              error: function error(jqXHR, textStatus, errorThrown) {
                // If the response contained an error, print the error in the alert box
                if (jqXHR.responseText.indexOf("File too large") !== -1) {
                  $('#alertBox').html("<strong>File too large!</strong> Maximum file size is 2MB").show('slide');
                } else {
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 4 hrs to fix
          public/javascripts/service.js on lines 650..660

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

          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

            Timeago.prototype.render = function (nodes, locale) {
              if (nodes.length === undefined) nodes = [nodes];
              for (var i = 0, len = nodes.length; i < len; i++) {
                this.doRender(nodes[i], getDateAttr(nodes[i]), locale); // render item
              }
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 3 hrs to fix
          public/javascripts/src/service.js on lines 1185..1190

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

          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

            $('.' + name + '-table-link').click(function (elem) {
              $('.' + name + '-segment').hide();
              $('.' + name + '-segment-' + elem.target.innerHTML).show();
            });
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 2 hrs to fix
          public/javascripts/src/service.js on lines 968..971

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

          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

              'en': function en(number, index) {
                if (index === 0) return ['just now', 'right now'];
                var unit = indexMapEn[parseInt(index / 2)];
                if (number > 1) unit += 's';
                return [number + ' ' + unit + ' ago', 'in ' + number + ' ' + unit];
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 2 hrs to fix
          public/javascripts/src/service.js on lines 1025..1030

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

          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

          $(document).on("click", ".addNum", function () {
            var number = $(this).data('num');
            number = '61' + number.substring(1, number.length);
            $(".modal-body #tosms").val(number);
          });
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 2 hrs to fix
          public/javascripts/src/service.js on lines 433..437

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

          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

          $('#photoUploadRow').on('click', 'a[id^=imagethumbnailmodal]', function (event) {
            console.log('open modal');
            event.preventDefault();
            $(this).closest('div[data=image]').children('div[id^=deleteimagemodal-image]').modal('show');
          });
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 2 hrs to fix
          public/javascripts/src/service.js on lines 854..858

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

          function getAge(date) {
            var today = Date.now();
            var age = new Date(today - new Date(date).getTime());
            return Math.abs(age.getUTCFullYear() - 1970);
          }
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 269..273

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

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

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

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

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

          Refactorings

          Further Reading

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

          function fetchBedsAvailable() {
            $.get('/service/beds/available', function (services) {
              $('#spinnerBedsAvailable').hide();
          
              addPagination('crisis', services.crisis);
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 978..986

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

          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 index = _ref4.index,
                name = _ref4.name,
                email = _ref4.email,
                number = _ref4.number,
                age = _ref4.age,
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/service.js on lines 311..317

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

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

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

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

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

          Refactorings

          Further Reading

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

            function setTidAttr(node, val) {
              if (node.setAttribute) return node.setAttribute(ATTR_DATA_TID, val); // native
              if (node.attr) return node.attr(ATTR_DATA_TID, val); // jquery
            }
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 1114..1117

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

          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 index = _ref3.index,
                name = _ref3.name,
                email = _ref3.email,
                number = _ref3.number,
                age = _ref3.age,
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/service.js on lines 343..349

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

          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

            for (var i = 0; i < numSegments; i++) {
              var num = i + 1;
              links += '<li><a href="' + linkTo + '" class="' + name + '-table-link">' + num + '</a></li>';
            }
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 957..960

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

          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

              'zh_CN': function zh_CN(number, index) {
                if (index === 0) return ['刚刚', '片刻后'];
                var unit = indexMapZh[parseInt(index / 2)];
                return [number + unit + '前', number + unit + '后'];
              }
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 1031..1035

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

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

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

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

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

          Refactorings

          Further Reading

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

            function getAttr(node, name) {
              if (node.getAttribute) return node.getAttribute(name); // native
              if (node.attr) return node.attr(name); // jquery
            }
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 1109..1112

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

          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

            return '\n  <div class="panel shadow">\n    <div class="panel-body">\n      <div class="row text-center" style=\'padding-top: 16px;\'>\n        <div class="col-sm-3 col-xs-6">\n          <input type="text" name="beds[' + index + '][name]" id="bedName' + index + '" value="' + name + '" required placeholder="Bed Name" class="form-control"/>\n        </div>\n        <div class="col-sm-3 col-xs-6">\n          <select name="beds[' + index + '][gender]" id="bedGender' + index + '" required class="form-control">\n            <option hidden=\'true\'>Gender</option>\n            <option value=\'Male\'>Male</option>\n            <option value=\'Female\'>Female</option>\n            <option value=\'Either\'>Either</option>\n          </select>\n        </div>\n        <div class="col-sm-3 col-xs-6">\n          <select name="beds[' + index + '][bedType]" id="bedType' + index + '" required class="form-control">\n            <option hidden=\'true\'>Bed Type</option>\n            <option value=\'Single\'>Single</option>\n            <option value=\'ParentChild\'>Parent with Child</option>\n          </select>\n        </div>\n        <div class="col-sm-3 col-xs-6">\n          <a href="Remove Bed" class="btn btn-primary">\n             Remove Bed\n          </a>\n        </div>\n      </div>\n    </div>\n  </div>\n';
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/service.js on lines 307..307

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

          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

                $('#' + name + '-table').append('\n      <tr class="table-panel ' + name + '-segment ' + name + '-segment-' + numSegments + '">\n        <td class=\'' + name + '-table-service-name\'>' + service.serviceName + '</td>\n        <td>' + service.phoneNumber + '</td>\n      </tr>\n      ');
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/service.js on lines 765..765

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

          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

                $('#' + name + '-table').append('\n      <tr class="table-panel ' + name + '-segment ' + name + '-segment-' + numSegments + '">\n        <td class=\'' + name + '-table-service-name\'>' + service.serviceName + '</td>\n        <td>' + service.numBeds + '</td>\n        <td>' + service.numMale + '</td>\n        <td>' + service.numFemale + '</td>\n        <td>' + service.numEither + '</td>\n        <td>' + service.phoneNumber + '</td>\n      </tr>\n      ');
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/service.js on lines 763..763

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

          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

            return '\n  <div class="panel shadow">\n    <div class="panel-body">\n      <div class="row text-center">\n        <div class="col-xs-6 col-sm-2">\n          <h4 id="bedtype' + index + '" style="text-transform: uppercase;">ICON</h4>\n        </div>\n        <div class="col-xs-6 col-sm-4">\n          <h4>' + name + '</h4>\n        </div>\n        <div class="col-xs-4 col-sm-2">\n          <h6>Available</h6>\n          <input type="radio" name="beds[' + index + '][isOccupied]" value="Available" id=\'available' + index + '\' />\n        </div>\n        <div class="col-xs-4 col-sm-2">\n          <h6>Pending</h6>\n          <input type="radio" name="beds[' + index + '][isOccupied]" value="Pending" id=\'pending' + index + '\' />\n        </div>\n        <div class="col-xs-4 col-sm-2">\n          <h6>Occupied</h6>\n          <input type="radio" name="beds[' + index + '][isOccupied]" value="Unavailable" id=\'unavailable' + index + '\' />\n        </div>\n      </div>\n    </div>\n  </div>\n';
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/service.js on lines 73..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 57.

          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

          $(document).on("click", ".addEmail", function () {
            var email = $(this).data('email');
            $(".modal-body #toemail").val(email);
          });
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 439..442

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

          $('#bedList').on('click', '[href="Remove Bed"]', function (event) {
            event.preventDefault();
            $(this).closest('div.panel.shadow').remove();
          });
          Severity: Major
          Found in public/javascripts/service.js and 1 other location - About 1 hr to fix
          public/javascripts/src/service.js on lines 37..40

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

          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

            return '\n  <div class="modal fade" id="closedRequestModal' + index + '">\n    <div class="modal-dialog">\n      <div class="modal-content">\n        <div class="modal-body">\n          <p id="closedRequestId' + index + '" style="display: none;">' + request['_id'] + '</p>\n          <h3>' + request.firstName + ' ' + request.lastName + '\'s request</h4>\n          <h4 style="margin-top: 2em;">Applied</h4>\n          <p>' + timeago().format(request.openedAt) + '</p>\n          <h4 style="margin-top: 1em;">Notes</h4>\n          <textarea class="form-control" rows="5" id="closedRequestNote' + index + '">' + request.note + '</textarea>\n          <button class="btn btn-primary" style="margin-top: 1em" id="closedUpdateNoteBtn' + index + '" type="button">Save note</button>\n          <button class="btn btn-secondary pull-right" style="margin-top: 1em" id="reopenClosedReqBtn' + index + '" type="button">Reopen Request</button>\n        </div>\n      </div>\n    </div>\n  </div>\n';
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 55 mins to fix
          public/javascripts/service.js on lines 252..252

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

            return '\n  <div class="modal fade" id="requestModal' + index + '">\n    <div class="modal-dialog">\n      <div class="modal-content">\n        <div class="modal-header">\n          <button type="button" data-dismiss="modal" class="close">&times;</button>\n          <p id="requestId' + index + '" style="display: none;">' + request['_id'] + '</p>\n          <h4 style="font-weight: bold;">' + request.firstName + ' ' + request.lastName + '\'s request</h4>      \n        </div>\n        <div class="modal-body">\n          <h4>Applied</h4>\n          <p>' + new Date(request.openedAt).toLocaleString() + '</p>\n          <h4 style="margin-top: 1em;">Notes</h4>\n          <textarea class="form-control" rows="5" id="requestNote' + index + '" style="resize:none;">' + request.note + '</textarea>\n          <button class="btn btn-primary" style="margin-top: 1em" id="updateNoteBtn' + index + '" type="button">Save note</button\n        </div>\n      </div>\n    </div>\n  </div>\n';
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 55 mins to fix
          public/javascripts/service.js on lines 256..256

          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

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

            if (num !== '04') {
              html += '       <h5>' + number + '</h5>\n            ';
            } else {
              html += '        <a href=\'#\' class=\'addNum\' data-toggle=\'modal\' data-target=\'#smsmodal\' data-num=\'' + number + '\'>\n              <h5>' + number + '</h5>\n              </a>\n              ';
            }
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 55 mins to fix
          public/javascripts/service.js on lines 353..357

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

          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

            if (num !== '04') {
              html += '       <h5>' + number + '</h5>\n            ';
            } else {
              html += '        <a href=\'#\' class=\'addNum\' data-toggle=\'modal\' data-target=\'#smsmodal\' data-num=\'' + number + '\'>\n              <h5>' + number + '</h5>\n              </a>\n              ';
            }
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 55 mins to fix
          public/javascripts/service.js on lines 321..325

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

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

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

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

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

          Refactorings

          Further Reading

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

            function Timeago(nowDate, defaultLocale) {
              this.nowDate = nowDate;
              // if do not set the defaultLocale, set it with `en`
              this.defaultLocale = defaultLocale || 'en'; // use default build-in locale
              // for dev test
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 55 mins to fix
          public/javascripts/src/service.js on lines 1135..1141

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

          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

          $('#addBed').click(function () {
            $('#bedList').append(BedPanel({ index: bedIndex++, name: "" }));
          });
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 50 mins to fix
          public/javascripts/src/service.js on lines 33..35

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

          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 AddImagePanel = function AddImagePanel(_ref6) {
            var uri = _ref6.uri,
                route = _ref6.route;
            return '\n  <div class="col-sm-2 col-xs-6" data="addImage" style="display: none;">\n    <form action=\'/service/profile/' + uri + route + '\' method=\'post\' enctype=\'multipart/form-data\'>\n      <div class=\'thumbnail\' style=\'line-height: 0px;\'>\n        <div class=\'image highlight\'>\n          <label style="margin: 0px;">\n            <img class=\'img-responsive\' id=\'plus-img\' src=\'/images/plus.png\' alt=\'Add Image\' style=\'cursor: pointer;\'/>\n            <img class=\'img-responsive\' id=\'spinner-gif\' src=\'/images/loading_spinner.gif\' style=\'display: none;\'/>\n            <input type=\'file\' accept=\'image/*\' hidden=\'\' name=\'fileAdd\' />\n          </label>\n        </div>\n      </div>\n    </form>\n  </div>\n';
          };
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 45 mins to fix
          public/javascripts/service.js on lines 749..753

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

          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 AddImagePanelIE = function AddImagePanelIE(_ref7) {
            var uri = _ref7.uri,
                route = _ref7.route;
            return '\n  <div class="col-sm-3 col-xs-6" data="addImage" style="display: none;">\n    <form action=\'/service/profile/' + uri + route + '\' method=\'post\' enctype=\'multipart/form-data\'>\n      <input type=\'file\' accept=\'image/*\' name=\'fileAdd\' />\n    </form>\n  </div>\n';
          };
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 45 mins to fix
          public/javascripts/service.js on lines 743..747

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

          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 diffSec(date, nowDate) {
              nowDate = nowDate ? toDate(nowDate) : new Date();
              return (nowDate - toDate(date)) / 1000;
            }
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 40 mins to fix
          public/javascripts/src/service.js on lines 1080..1083

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

          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

            Timeago.prototype.format = function (date, locale) {
              return formatDiff(diffSec(date, this.nowDate), locale, this.defaultLocale);
            };
          Severity: Minor
          Found in public/javascripts/service.js and 1 other location - About 40 mins to fix
          public/javascripts/src/service.js on lines 1168..1170

          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