CiviWiki/OpenCiviWiki

View on GitHub

Showing 50 of 22,315 total issues

Avoid too many return statements within this function.
Open

        return HttpResponseServerError(reason=str(e))
Severity: Major
Found in project/threads/api.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return HttpResponseForbidden("allowed only via POST")
    Severity: Major
    Found in project/threads/api.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return JsonResponse({"data": return_data})
      Severity: Major
      Found in project/threads/api.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return HttpResponseForbidden("allowed only via POST")
        Severity: Major
        Found in project/threads/api.py - About 30 mins to fix

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

              loadMoreCivis: function(e) {
                  var $target = $(e.currentTarget);
                  var type = $target.data('civi-type');
                  var limit, remaining;
                  if (this.viewRecommended) {
          Severity: Minor
          Found in project/core/templates/static/js/thread.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

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

          def get_responses(request, thread_id, civi_id):
              """
              USAGE:
                 This is used to get responses for a Civi
              """
          Severity: Minor
          Found in project/threads/api.py - 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

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

              drilldownCivi: function (e) {
                  var target = $(e.target);
                  var ms_check = target.hasClass('ms-ctn') || target.hasClass('ms-sel-ctn') || target.hasClass('ms-close-btn') || target.hasClass('ms-trigger') || target.hasClass('ms-trigger-ico') || target.hasClass('ms-res-ctn') || target.hasClass('ms-sel-item') || target.hasClass('ms-res-group');
          
                  if (target.hasClass('btn') || target.hasClass('rating-button') || target.is('input') || target.is('textarea') || target.is('label') || target.hasClass('input') || ms_check) {
          Severity: Minor
          Found in project/core/templates/static/js/thread.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

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

          def json_custom_parser(obj):
              """
              A custom json parser to handle json.dumps calls properly
              for Decimal and Datetime data types.
              """
          Severity: Minor
          Found in project/threads/utils.py - 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

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

              def clean_profile_image(self):
                  """
                  This function is used to make sure that profile images
                  follow Civiwiki standards.
          
          
          Severity: Minor
          Found in project/accounts/forms.py - 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

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

          def civi2csv(request, thread_id):
              """
              CSV export function. Thread ID goes in, CSV HTTP response attachment goes out.
              """
              import csv
          Severity: Minor
          Found in project/threads/views.py - 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

          Severity
          Category
          Status
          Source
          Language