CiviWiki/OpenCiviWiki

View on GitHub

Showing 22,315 of 22,315 total issues

File thread.js has 1688 lines of code (exceeds 250 allowed). Consider refactoring.
Open

cw = cw || {};

cw.DEFAULTS = {
    types: ['problem', 'cause', 'solution'],
    types_plural: ['problems', 'causes', 'solutions'],
Severity: Major
Found in project/core/templates/static/js/thread.js - About 4 days to fix

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

                                success: function (response2) {
    
                                    Materialize.toast('Saved.', 5000);
    
                                    // Set the models with new data and rerender
    Severity: Major
    Found in project/core/templates/static/js/thread.js and 1 other location - About 2 days to fix
    project/core/templates/static/js/thread.js on lines 533..565

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

    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

                                error: function(e){
                                    Materialize.toast('Civi was edited but one or more images could not be uploaded', 5000);
    
                                    // Set the models with new data and rerender
                                    _this.model.set('title', new_title);
    Severity: Major
    Found in project/core/templates/static/js/thread.js and 1 other location - About 2 days to fix
    project/core/templates/static/js/thread.js on lines 499..532

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

    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

        previewImageNames: function(e) {
            var attachment_input = this.$('#id_attachment_image');
            var uploaded_images = attachment_input[0].files;
            var $previewlist = this.$('.file-preview');
            $previewlist.empty();
    Severity: Major
    Found in project/core/templates/static/js/thread.js and 2 other locations - About 1 day to fix
    project/core/templates/static/js/thread.js on lines 715..748
    project/core/templates/static/js/thread.js on lines 946..979

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

    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

        previewImageNames: function(e) {
            var attachment_input = this.$('#id_attachment_image');
            var uploaded_images = attachment_input[0].files;
            var $previewlist = this.$('.file-preview');
            $previewlist.empty();
    Severity: Major
    Found in project/core/templates/static/js/thread.js and 2 other locations - About 1 day to fix
    project/core/templates/static/js/thread.js on lines 207..240
    project/core/templates/static/js/thread.js on lines 946..979

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

    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

        previewImageNames: function(e) {
            var attachment_input = this.$('#response_attachment_image');
            var uploaded_images = attachment_input[0].files;
            var $previewlist = this.$('.file-preview');
            $previewlist.empty();
    Severity: Major
    Found in project/core/templates/static/js/thread.js and 2 other locations - About 1 day to fix
    project/core/templates/static/js/thread.js on lines 207..240
    project/core/templates/static/js/thread.js on lines 715..748

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

    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

    Function saveEdit has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        saveEdit: function(e) {
            e.stopPropagation();
            var _this = this;
            var c_type = this.model.get('type');
            var new_body = this.$('.edit-civi-body').val().trim();
    Severity: Minor
    Found in project/core/templates/static/js/thread.js - About 1 day 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 saveEdit has 177 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        saveEdit: function(e) {
            e.stopPropagation();
            var _this = this;
            var c_type = this.model.get('type');
            var new_body = this.$('.edit-civi-body').val().trim();
    Severity: Major
    Found in project/core/templates/static/js/thread.js - About 7 hrs to fix

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

      cw.LandingView = BB.View.extend({
          el: '#landing',
          landingTemplate: _.template($('#landing-template').html()),
      
          initialize: function () {
      Severity: Major
      Found in project/core/templates/static/js/static/landing_view.js and 2 other locations - About 7 hrs to fix
      project/core/templates/static/js/static/about_view.js on lines 3..21
      project/core/templates/static/js/static/how_it_works_view.js on lines 3..21

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

      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

      cw.HowItWorksView = BB.View.extend({
          el: '#howitworks',
          howitworksTemplate: _.template($('#howitworks-template').html()),
      
          initialize: function () {
      project/core/templates/static/js/static/about_view.js on lines 3..21
      project/core/templates/static/js/static/landing_view.js on lines 3..22

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

      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

      cw.AboutView = BB.View.extend({
          el: '#about',
          aboutTemplate: _.template($('#about-template').html()),
      
          initialize: function () {
      Severity: Major
      Found in project/core/templates/static/js/static/about_view.js and 2 other locations - About 7 hrs to fix
      project/core/templates/static/js/static/how_it_works_view.js on lines 3..21
      project/core/templates/static/js/static/landing_view.js on lines 3..22

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

      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

      File models.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import datetime
      import json
      import math
      import os
      from calendar import month_name
      Severity: Minor
      Found in project/threads/models.py - About 6 hrs to fix

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

                                        success: function (response2) {
                                            Materialize.toast('Saved changes', 5000);
                                            // _this.hide();
        
                                            new_data = response.data;
        Severity: Major
        Found in project/core/templates/static/js/thread.js and 1 other location - About 6 hrs to fix
        project/core/templates/static/js/thread.js on lines 1168..1181

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

        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 (response2) {
                                            Materialize.toast('Saved changes', 5000);
                                            // _this.hide();
        
        
        
        Severity: Major
        Found in project/core/templates/static/js/thread.js and 1 other location - About 6 hrs to fix
        project/core/templates/static/js/thread.js on lines 1231..1242

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

        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

        File api.py has 415 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        
        from accounts.models import Profile
        from common.utils import check_database, save_image_from_url
        from core.custom_decorators import require_post_params
        Severity: Minor
        Found in project/threads/api.py - About 5 hrs to fix

          Function editThread has 125 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              editThread: function (e) {
                  var _this = this;
                  _this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
          
                  var title = this.$el.find('#thread-title').val().trim();
          Severity: Major
          Found in project/core/templates/static/js/thread.js - About 5 hrs to fix

            Function success has 118 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            success: function (response) {
                                _this.closeEdit(e);
                                // var score = $this.find('.rate-value');
                                // var new_vote = parseInt(score.text())+ 1;
                                // score.text(new_vote);
            Severity: Major
            Found in project/core/templates/static/js/thread.js - About 4 hrs to fix

              Function createCivi has 104 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  createCivi: function (e) {
                      var _this = this;
              
                      var title = this.$el.find('#civi-title').val(),
                          body = this.$el.find('#civi-body').val(),
              Severity: Major
              Found in project/core/templates/static/js/thread.js - About 4 hrs to fix

                Function renderOutline has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    renderOutline: function(){
                        var _this = this;
                        if (this.civis.length === 0){
                            // render with mock data to prevent errors
                            var mockData = {
                Severity: Major
                Found in project/core/templates/static/js/thread.js - About 4 hrs to fix

                  Function success has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  success: function (response) {
                                      var file = $('#thread_attachment_image').val();
                                      var img_url = _this.$('#link-image-form').val().trim();
                                      if (_this.removeImage) {
                                          // if file
                  Severity: Major
                  Found in project/core/templates/static/js/thread.js - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language