django/django

View on GitHub

Showing 1,786 of 2,094 total issues

Function _insert has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _insert(
Severity: Major
Found in django/db/models/query.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if (isinstance(k, int) and k < 0) or (
                isinstance(k, slice)
                and (
                    (k.start is not None and k.start < 0)
                    or (k.stop is not None and k.stop < 0)
    Severity: Major
    Found in django/db/models/query.py - About 1 hr to fix

      Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in django/db/models/fields/reverse_related.py - About 1 hr to fix

        Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in django/db/models/fields/reverse_related.py - About 1 hr to fix

          Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in django/db/models/query.py - About 1 hr to fix

            Function collect has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def collect(
            Severity: Major
            Found in django/db/models/deletion.py - About 1 hr to fix

              Function _alter_field has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def _alter_field(
              Severity: Major
              Found in django/db/backends/sqlite3/schema.py - About 1 hr to fix

                Function _alter_field has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def _alter_field(
                Severity: Major
                Found in django/db/backends/postgresql/schema.py - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if field.many_to_many and field.remote_field.through._meta.auto_created:
                              self.create_model(field.remote_field.through)
                          elif (
                              # Primary keys and unique fields are not supported in ALTER TABLE
                              # ADD COLUMN.
                  Severity: Major
                  Found in django/db/backends/sqlite3/schema.py - About 1 hr to fix

                    Function _delete_unique_sql has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def _delete_unique_sql(
                    Severity: Major
                    Found in django/db/backends/base/schema.py - About 1 hr to fix

                      Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Major
                      Found in django/forms/formsets.py - About 1 hr to fix

                        Function _alter_field has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def _alter_field(
                        Severity: Major
                        Found in django/db/backends/base/schema.py - About 1 hr to fix

                          Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def __init__(
                          Severity: Major
                          Found in django/contrib/admin/helpers.py - About 1 hr to fix

                            Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def __init__(
                            Severity: Major
                            Found in django/forms/models.py - About 1 hr to fix

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

                                  def _get_secret(self, request):
                                      """
                                      Return the CSRF secret originally associated with the request, or None
                                      if it didn't have one.
                              
                              
                              Severity: Minor
                              Found in django/middleware/csrf.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 get_template_directories has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def get_template_directories():
                                  # Iterate through each template backend and find
                                  # any template_loader that has a 'get_dirs' method.
                                  # Collect the directories, filtering out Django templates.
                                  cwd = Path.cwd()
                              Severity: Minor
                              Found in django/template/autoreload.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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def render(self, context):
                                      for condition, nodelist in self.conditions_nodelists:
                                          if condition is not None:  # if / elif clause
                                              try:
                                                  match = condition.eval(context)
                              Severity: Minor
                              Found in django/template/defaulttags.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 get_template has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def get_template(self, template_name, skip=None):
                                      """
                                      Perform the caching that gives this loader its name. Often many of the
                                      templates attempted will be missing, so memory use is of concern here.
                                      To keep it in check, caching behavior is a little complicated when a
                              Severity: Minor
                              Found in django/template/loaders/cached.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 send_robust has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def send_robust(self, sender, **named):
                                      """
                                      Send signal from sender to all connected receivers catching errors.
                              
                                      If any receivers are asynchronous, they are called after all the
                              Severity: Minor
                              Found in django/dispatch/dispatcher.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 do_for has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              def do_for(parser, token):
                                  """
                                  Loop over each item in an array.
                              
                                  For example, to display a list of athletes given ``athlete_list``::
                              Severity: Minor
                              Found in django/template/defaulttags.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

                              Severity
                              Category
                              Status
                              Source
                              Language