django/django

View on GitHub

Showing 1,649 of 2,141 total issues

Avoid too many return statements within this function.
Open

                return cls.time_strings['future-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 self.expand_to_include(args)
    Severity: Major
    Found in django/contrib/gis/gdal/envelope.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return cls.time_strings['past-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 'runtests.py ' + args_to_win(line[15:])
        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 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

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

                        def make_context(context, request=None, **kwargs):
                            """
                            Create a suitable Context from a plain dict and optionally an HttpRequest.
                            """
                            if context is not None and not isinstance(context, dict):
                        Severity: Minor
                        Found in django/template/context.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 get_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def get_parent(self, context):
                                parent = self.parent_name.resolve(context)
                                if not parent:
                                    error_msg = "Invalid template name in 'extends' tag: %r." % parent
                                    if self.parent_name.filters or\
                        Severity: Minor
                        Found in django/template/loader_tags.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def render(self):
                                """Render (thereby finalizing) the content of the response.
                        
                                If the content has already been rendered, this is a no-op.
                        
                        
                        Severity: Minor
                        Found in django/template/response.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 lorem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def lorem(parser, token):
                            """
                            Create random Latin text useful for providing test data in templates.
                        
                            Usage format::
                        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

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

                            def split_contents(self):
                                split = []
                                bits = smart_split(self.contents)
                                for bit in bits:
                                    # Handle translation-marked template pieces
                        Severity: Minor
                        Found in django/template/base.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 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

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

                            def render(self, context):
                                block_context = context.render_context.get(BLOCK_CONTEXT_KEY)
                                with context.push():
                                    if block_context is None:
                                        context['block'] = self
                        Severity: Minor
                        Found in django/template/loader_tags.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 page_not_found has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def page_not_found(request, exception, template_name=ERROR_404_TEMPLATE_NAME):
                            """
                            Default 404 handler.
                        
                            Templates: :template:`404.html`
                        Severity: Minor
                        Found in django/views/defaults.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