studpad/studpad

View on GitHub
app/assets/javascripts/my_scripts.js

Summary

Maintainability
F
6 days
Test Coverage

Function main has 230 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function main(){
    $('#hat-search').autocomplete({
      serviceUrl: '/tags',
      paramName: 'term',
      deferRequestBy: 200,
Severity: Major
Found in app/assets/javascripts/my_scripts.js - About 1 day to fix

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

          load: function(query, callback) {
            CL('selectize', query, callback);
            if (query.length < 3) return callback();
            $.ajax({
              url: '/ajax/get_cities?term=' + encodeURIComponent(query),
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 2 other locations - About 5 hrs to fix
    app/assets/javascripts/components/tag_select.js.jsx on lines 19..34
    app/assets/javascripts/my_scripts.js on lines 27..42

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 153.

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

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

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

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

    Refactorings

    Further Reading

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

          load: function(query, callback) {
            CL('selectize', query, callback);
            if (query.length < 3) return callback();
            $.ajax({
              url: '/ajax/get_cities?term=' + encodeURIComponent(query),
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 2 other locations - About 5 hrs to fix
    app/assets/javascripts/components/tag_select.js.jsx on lines 19..34
    app/assets/javascripts/my_scripts.js on lines 47..62

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 153.

    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

        if(nextStation == 'last-publicators'){
          var description = "Те, кто разместил публикации сегодня, попадают сюда. Хотите, чтобы Вас заметили? Публикуйте чаще.";
          $('#profile_user').css('z-index', '999').css('position', 'static');
          $('.first-left-block').css('z-index', '2000').css('position', 'relative');
          $('.description-hdiw').removeClass('description-hdiw-me').addClass('description-hdiw-' + nextStation).html(description);
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 5 hrs to fix
    app/assets/javascripts/my_scripts.js on lines 335..343

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

    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

        if(nextStation == 'me'){
          var description = "Здесь все просто! Это ссылка на Ваш микроблог.";
          $('.post-container').css('z-index', '999').css('position', 'static');
          $('#profile_user').css('z-index', '2000').css('position', 'relative');
          $('.description-hdiw').removeClass('description-hdiw-publications').addClass('description-hdiw-' + nextStation).html(description);
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 5 hrs to fix
    app/assets/javascripts/my_scripts.js on lines 345..353

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

    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

        if(nextStation == 'recommend-people'){
          var description = "После регистрации Вам доступны публикации только тех, кто имеет одинаковую с Вами специализацию . Если Вы хотите получать больше интересных публикаций , то выбирайте и читайте тех, кто Вам интересен. Тогда Вы будете видеть всё, что они опубликовали у себя в микроблоге.";
          $('.first-left-block').css('z-index', '999');
          $('.follow-offer').css('z-index', '2000').css('position', 'relative');
          $('.description-hdiw').removeClass('description-hdiw-last-publicators').addClass('description-hdiw-' + nextStation).html(description);
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 4 hrs to fix
    app/assets/javascripts/my_scripts.js on lines 325..333

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

    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

        if(nextStation == 'publications'){
          var description = "Здесь Вы можете увидеть все публикации коллег Вашей специализации. Вы можете оставить комментарий или же просто сказать спасибо, ведь публиковали именно для Вас! Если Вы хотите получать больше публикаций, для этого читайте больше людей!";
          $('.wrap-mike').css('z-index', '999');
          $('.post-container').css('z-index', '2000').css('position', 'relative');
          $('.description-hdiw').removeClass('description-hdiw-mike-speach').addClass('description-hdiw-' + nextStation).html(description);
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 4 hrs to fix
    app/assets/javascripts/my_scripts.js on lines 355..363

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

    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

      $('#classroom_name').change(function(){
        val = $(this).val();
        if(val){
          $('#btn-create-class').removeAttr('disabled');
        }
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/my_scripts.js on lines 257..265

    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

      $('#community_name').change(function(){
        val = $(this).val();
        if(val){
          $('#btn-create-community').removeAttr('disabled');
        }
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 2 hrs to fix
    app/assets/javascripts/my_scripts.js on lines 247..255

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 79.

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

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

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

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

    Refactorings

    Further Reading

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

      $.emojiarea.icons = {
          ':smiley:'         : 'smile1.png',
          ':blush:'          : 'smile2.png',
          ':wink:'           : 'smile4.png',
          ':yum:'            : 'smile9.png',
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/emotions.js on lines 462..474

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 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

      $(".btn-follow").mouseover(function(){
          $(this).removeClass('btn-follow-on').removeClass('btn-primary').addClass('btn-st-red');
          $(this).html('Отмена');
      });
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/my_scripts.js on lines 289..292

    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

      $(".btn-follow").mouseout(function(){
          $(this).addClass('btn-follow-on').addClass('btn-primary').removeClass('btn-st-red');
          $(this).html('Читаю');
      });
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/my_scripts.js on lines 285..288

    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

      $('#join-to-community').click(function(){
        $(this).css('display', 'none');
        $(this).parent().prepend('<span>Вы с нами!</span>');
      });
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/my_scripts.js on lines 272..275

    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

      $('#join-to-class').click(function(){
        $(this).css('display', 'none');
        $(this).parent().prepend('<span>Вы с нами!</span>');
      });
    Severity: Major
    Found in app/assets/javascripts/my_scripts.js and 1 other location - About 1 hr to fix
    app/assets/javascripts/my_scripts.js on lines 267..270

    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

    There are no issues that match your filters.

    Category
    Status