OmarElGabry/miniPHP

View on GitHub
public/js/main.js

Summary

Maintainability
F
1 wk
Test Coverage

File main.js has 595 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  Document   : main.js
 *  Author     : Omar El Gabry <omar.elgabry.93@gmail.com>
 *  Description: Main Javascript file for the application.
 *               It handles all Ajax calls, Events, and DOM Manipulations
Severity: Major
Found in public/js/main.js - About 1 day to fix

    Function validateData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        validateData: function (result, targetBlock, errorFunc, errorType, returnVal){
    
            // 1. clear all existing error or success messages
            helpers.clearMessages(targetBlock);
    
    
    Severity: Minor
    Found in public/js/main.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 update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            update: function(){
                $("#list-newsfeed .header .edit").off('click').on('click', function() {
    
                    var newsfeedBody = $(this).parent().parent().parent().parent();
                    var newsfeedId   = newsfeedBody.attr("id");
    Severity: Minor
    Found in public/js/main.js - About 1 hr to fix

      Function update has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              update: function(){
      
                  $("#list-comments .header .edit").off('click').on('click', function() {
      
                      var commentBody = $(this).parent().parent().parent().parent();
      Severity: Minor
      Found in public/js/main.js - About 1 hr to fix

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

            upload: function(url, fileData, callback){
        
                $.ajax({
                    url: config.root + url,
                    type: "POST",
        Severity: Minor
        Found in public/js/main.js - About 1 hr to fix

          Function validateData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              validateData: function (result, targetBlock, errorFunc, errorType, returnVal){
          
                  // 1. clear all existing error or success messages
                  helpers.clearMessages(targetBlock);
          
          
          Severity: Minor
          Found in public/js/main.js - About 1 hr to fix

            Function send has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                send: function(url, postData, callback, spinnerBlock){
            
                    var spinnerEle = null;
            
                    $.ajax({
            Severity: Minor
            Found in public/js/main.js - About 1 hr to fix

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

                      init: function(){
              
                          $("ul.pagination a").click(function(e){
              
                              var pageNumber;
              Severity: Minor
              Found in public/js/main.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

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

                  validateData: function (result, targetBlock, errorFunc, errorType, returnVal){
              Severity: Minor
              Found in public/js/main.js - About 35 mins to fix

                Function init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    init: function (){
                
                        // initialize todo application event
                        events.todo.init();
                        
                Severity: Minor
                Found in public/js/main.js - About 35 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

                Avoid too many return statements within this function.
                Open

                                return false;
                Severity: Major
                Found in public/js/main.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return true;
                  Severity: Major
                  Found in public/js/main.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return false;
                    Severity: Major
                    Found in public/js/main.js - About 30 mins to fix

                      Function appendCsrfToken has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          appendCsrfToken: function (data){
                      
                              if(typeof (data) === "string"){
                                  if(data.length > 0){
                                      data = data + "&csrf_token=" + config.csrfToken;
                      Severity: Minor
                      Found in public/js/main.js - About 25 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

                              update: function(){
                                  $("#list-newsfeed .header .edit").off('click').on('click', function() {
                      
                                      var newsfeedBody = $(this).parent().parent().parent().parent();
                                      var newsfeedId   = newsfeedBody.attr("id");
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 2 days to fix
                      public/js/main.js on lines 690..742

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

                      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

                              update: function(){
                      
                                  $("#list-comments .header .edit").off('click').on('click', function() {
                      
                                      var commentBody = $(this).parent().parent().parent().parent();
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 2 days to fix
                      public/js/main.js on lines 554..610

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

                      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

                              delete: function(){
                      
                                  $("#list-newsfeed .header .delete").off('click').on('click', function(e) {
                                      e.preventDefault();
                                      if (!confirm("Are you sure?")) { return; }
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 7 hrs to fix
                      public/js/main.js on lines 743..759

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 179.

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

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

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

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

                      Refactorings

                      Further Reading

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

                              delete: function(){
                      
                                  $("#list-comments .header .delete").off('click').on('click', function(e) {
                                      e.preventDefault();
                                      if (!confirm("Are you sure?")) { return; }
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 7 hrs to fix
                      public/js/main.js on lines 611..627

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 179.

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

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

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

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

                      Refactorings

                      Further Reading

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

                              get_search_callback: function(result){
                                  if(helpers.validateData(result, "#form-search-users", "after", "default", "data")){
                                      $("#list-users tbody").html(result.data.users);
                                      events.users.reInit();
                      
                      
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 4 hrs to fix
                      public/js/main.js on lines 659..669

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

                      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 getCommentsCallBack(result){
                                      if(helpers.validateData(result, "#list-comments", "html", "default", "data")){
                                          $("#list-comments").append(result.data.comments);
                                          events.comments.reInit();
                      
                      
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 4 hrs to fix
                      public/js/main.js on lines 847..857

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

                      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

                                  $("#link-register").click(function() {
                                      
                                      $("#form-login, #form-forgot-password").addClass("display-none");
                                      $("#form-register").removeClass("display-none");
                                      $(".panel-title").text("Register");
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 2 hrs to fix
                      public/js/main.js on lines 521..527

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 79.

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

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

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

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

                      Refactorings

                      Further Reading

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

                                  $("#form-register #link-login").click(function() {
                                      
                                      $(".panel-title").text("Login");
                                      $("#form-register").addClass("display-none");
                                      $("#form-login").removeClass("display-none");
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 2 hrs to fix
                      public/js/main.js on lines 513..519

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 79.

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

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

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

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

                      Refactorings

                      Further Reading

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

                                  $("#form-create-comment").submit(function(e){
                                      e.preventDefault();
                                      ajax.send("Comments/create", helpers.serialize(this, "post_id="+config.postId), createCommentCallBack, "#form-create-comment");
                                  });
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 1 hr to fix
                      public/js/main.js on lines 860..863

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 62.

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

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

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

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

                      Refactorings

                      Further Reading

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

                                  $("#form-update-user-info").submit(function(e){
                                      e.preventDefault();
                                      ajax.send("Admin/updateUserInfo", helpers.serialize(this, "user_id="+config.userId), updateUserInfoCallBack, "#form-update-user-info");
                                  });
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 1 hr to fix
                      public/js/main.js on lines 673..676

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 62.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          runSpinner: function(spinnerBlock, spinnerEle){
                      
                              if(!helpers.empty(spinnerBlock)) {
                                  // var spinner = $(spinnerBlock).nextAll(".spinner:eq(0)");
                                  $(spinnerEle).show();
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 1 hr to fix
                      public/js/main.js on lines 139..145

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

                      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

                          stopSpinner: function(spinnerBlock, spinnerEle){
                              if(!helpers.empty(spinnerBlock) ) {
                                  // var spinner = $(spinnerBlock).nextAll(".spinner:eq(0)");
                                  $(spinnerEle).remove();
                                  $(spinnerBlock).css("opacity","1");
                      Severity: Major
                      Found in public/js/main.js and 1 other location - About 1 hr to fix
                      public/js/main.js on lines 131..138

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

                      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

                              init: function(){
                                  events.comments.create();
                                  events.comments.update();
                                  events.comments.delete();
                              },
                      Severity: Minor
                      Found in public/js/main.js and 1 other location - About 50 mins to fix
                      public/js/main.js on lines 821..825

                      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

                              init: function(){
                                  events.users.search();
                                  events.users.update();
                                  events.users.delete();
                              },
                      Severity: Minor
                      Found in public/js/main.js and 1 other location - About 50 mins to fix
                      public/js/main.js on lines 642..646

                      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

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

                                      switch (jqXHR.status){
                                          case 0:
                                              callback(null);
                                          case 302:
                                              helpers.redirectTo(config.root);
                      Severity: Minor
                      Found in public/js/main.js and 1 other location - About 30 mins to fix
                      public/js/main.js on lines 111..119

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 45.

                      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

                                      switch (jqXHR.status){
                                          case 0:
                                              callback(null);
                                          case 302:
                                              helpers.redirectTo(config.root);
                      Severity: Minor
                      Found in public/js/main.js and 1 other location - About 30 mins to fix
                      public/js/main.js on lines 60..68

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

                      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