CiviWiki/OpenCiviWiki

View on GitHub

Showing 50 of 22,315 total issues

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

                success: function (response) {
                    var attachment_input = _this.$('#response_attachment_image');
                    var uploaded_images = attachment_input[0].files;
                    if (_this.attachmentCount > 0) {
                        var formData = new FormData(_this.$('#response_attachment_image_form')[0]);
Severity: Minor
Found in project/core/templates/static/js/thread.js - About 1 hr to fix

    Function create_civi has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_civi(request):
        """
        USAGE:
            Use this function to insert a new connected civi into the database.
    
    
    Severity: Minor
    Found in project/threads/api.py - 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 render_notifications has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var render_notifications = function(data) {
        var unreadCount = parseInt(data.unread_count);
        if (unreadCount === 0) {
            $('#notify-count-wrapper').addClass('hide');
            $('#notify-icon').html('notifications_none').removeClass('active');
    Severity: Minor
    Found in project/core/templates/static/js/notifications.js - About 1 hr to fix

      Function clickRating has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          clickRating: function (e) {
              e.stopPropagation();
              var _this = this;
              var $this = $(e.currentTarget);
      
      
      Severity: Minor
      Found in project/core/templates/static/js/thread.js - About 1 hr to fix

        Function upload_thread_image has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def upload_thread_image(request):
            """This function is used to upload an image to a thread"""
            if request.method == "POST":
                r = request.POST
                thread_id = r.get("thread_id")
        Severity: Minor
        Found in project/threads/api.py - 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 renderResponses has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            renderResponses: function () {
                this.$('.responses-box').empty().append(this.responseWrapper());
                this.newResponseView = new cw.NewResponseView({
                    model: this.model,
                    parentView: this
        Severity: Minor
        Found in project/core/templates/static/js/thread.js - About 1 hr to fix

          Function clickFavorite has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              clickFavorite: function (e) {
                  var _this = this;
          
                  if ($this.text() === 'star_border') {
                      $.ajax({
          Severity: Minor
          Found in project/core/templates/static/js/thread.js - About 1 hr to fix

            Function deleteEdit has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                deleteEdit: function(e) {
                    var _this = this;
                    e.stopPropagation();
            
                    $.ajax({
            Severity: Minor
            Found in project/core/templates/static/js/thread.js - About 1 hr to fix

              Function publishThread has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  publishThread: function(e){
                      var _this = this;
                      _this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
              
                      $.ajax({
              Severity: Minor
              Found in project/core/templates/static/js/thread.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if (target.hasClass('btn') || target.hasClass('rating-button') || target.is('input') || target.is('textarea') || target.is('label') || target.hasClass('input') || ms_check) {
                            return;
                        }
                Severity: Major
                Found in project/core/templates/static/js/thread.js - About 1 hr to fix

                  Function clickRating has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      clickRating: function (e) {
                          e.stopPropagation();
                          var _this = this;
                          var $this = $(e.currentTarget);
                  
                  
                  Severity: Minor
                  Found in project/core/templates/static/js/thread.js - About 55 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 edit_civi has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def edit_civi(request):
                      """Use this function to edit an existing Civi"""
                      civi_id = request.POST.get("civi_id", "")
                      title = request.POST.get("title", "")
                      body = request.POST.get("body", "")
                  Severity: Minor
                  Found in project/threads/api.py - About 55 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 renderOutline has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      renderOutline: function(){
                          var _this = this;
                          if (this.civis.length === 0){
                              // render with mock data to prevent errors
                              var mockData = {
                  Severity: Minor
                  Found in project/core/templates/static/js/thread.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 delete_civi has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def delete_civi(request):
                      """Use this function to delete an existing Civi"""
                      civi_id = request.POST.get("civi_id", "")
                  
                      c = Civi.objects.get(id=civi_id)
                  Severity: Minor
                  Found in project/threads/api.py - 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 edit_thread has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def edit_thread(request):
                      """Use this function to edit an existing thread"""
                      thread_id = request.POST.get("thread_id")
                      non_required_params = [
                          "title",
                  Severity: Minor
                  Found in project/threads/api.py - 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

                  Consider simplifying this complex logical expression.
                  Open

                          } else if (this.imageRemoveList.length===0 && this.attachmentCount===0 && (new_body == this.model.get('body') && new_title == this.model.get('title') && _.isEqual(links, this.model.get('links')) && new_type == this.model.get('type') )){
                              this.closeEdit(e);
                              return;
                          } else {
                              var data;
                  Severity: Major
                  Found in project/core/templates/static/js/thread.js - About 40 mins to fix

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

                    def create_related_profile(sender, instance, created, *args, **kwargs):
                    Severity: Minor
                    Found in project/accounts/signals.py - About 35 mins to fix

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

                          def handle(self, *app_labels, name, dry_run, merge, **options):
                      Severity: Minor
                      Found in project/core/management/commands/makemigrations.py - About 35 mins to fix

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

                        def send_email(subject, message, sender, recipient_list, html_message=None):
                        Severity: Minor
                        Found in project/accounts/utils.py - About 35 mins to fix

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

                              def get(self, request, uidb64, token):
                          
                                  try:
                                      uid = force_str(urlsafe_base64_decode(uidb64))
                                      user = get_user_model().objects.get(pk=uid)
                          Severity: Minor
                          Found in project/accounts/views.py - 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

                          Severity
                          Category
                          Status
                          Source
                          Language