django/django

View on GitHub

Showing 1,784 of 2,092 total issues

Avoid too many return statements within this function.
Open

                return cls.time_strings["future-minute"] % {"count": count}
Severity: Major
Found in django/contrib/humanize/templatetags/humanize.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return cls.time_strings["past-hour"] % {"count": count}
    Severity: Major
    Found in django/contrib/humanize/templatetags/humanize.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return cls.time_strings["future-day"] % {
      Severity: Major
      Found in django/contrib/humanize/templatetags/humanize.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return cls.time_strings["now"]
        Severity: Major
        Found in django/contrib/humanize/templatetags/humanize.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return args_to_win(line[2:])
          Severity: Major
          Found in docs/_ext/djangodocs.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return str(o)
            Severity: Major
            Found in django/core/serializers/json.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return super().default(o)
              Severity: Major
              Found in django/core/serializers/json.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return args_to_win(line[4:])
                Severity: Major
                Found in docs/_ext/djangodocs.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return "py " + args_to_win(line[8:])
                  Severity: Major
                  Found in docs/_ext/djangodocs.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return None
                    Severity: Major
                    Found in docs/_ext/djangodocs.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                      return "py " + args_to_win(line[9:])
                      Severity: Major
                      Found in docs/_ext/djangodocs.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return "runtests.py " + args_to_win(line[15:])
                        Severity: Major
                        Found in docs/_ext/djangodocs.py - About 30 mins to fix

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

                              def _origin_verified(self, request):
                                  request_origin = request.META["HTTP_ORIGIN"]
                                  try:
                                      good_host = request.get_host()
                                  except DisallowedHost:
                          Severity: Minor
                          Found in django/middleware/csrf.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 sync_send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                                      def sync_send():
                                          responses = []
                                          for receiver in sync_receivers:
                                              try:
                                                  response = receiver(signal=self, sender=sender, **named)
                          Severity: Minor
                          Found in django/dispatch/dispatcher.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 process_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def process_request(self, request):
                                  """
                                  Check whether the page is already cached and return the cached
                                  version if available.
                                  """
                          Severity: Minor
                          Found in django/middleware/cache.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 receiver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def receiver(signal, **kwargs):
                              """
                              A decorator for connecting receivers to signals. Used by passing in the
                              signal (or list of signals) and keyword arguments to connect::
                          
                          
                          Severity: Minor
                          Found in django/dispatch/dispatcher.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 disableDrawing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              disableDrawing() {
                                  if (this.interactions.draw) {
                                      this.interactions.draw.setActive(false);
                                      if (this.typeChoices) {
                                          // Hide geometry type icons
                          Severity: Minor
                          Found in django/contrib/gis/static/gis/js/OLMapWidget.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 should_redirect_with_slash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def should_redirect_with_slash(self, request):
                                  """
                                  Return True if settings.APPEND_SLASH is True and appending a slash to
                                  the request path turns an invalid path into a valid one.
                                  """
                          Severity: Minor
                          Found in django/middleware/common.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 getDaysInMonth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  getDaysInMonth: function(month, year) {
                                      let days;
                                      if (month === 1 || month === 3 || month === 5 || month === 7 || month === 8 || month === 10 || month === 12) {
                                          days = 31;
                                      }
                          Severity: Minor
                          Found in django/contrib/admin/static/admin/js/calendar.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def render(self, context):
                                  try:
                                      value = self.val_expr.resolve(context)
                                      max_value = self.max_expr.resolve(context)
                                      max_width = int(self.max_width.resolve(context))
                          Severity: Minor
                          Found in django/template/defaulttags.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