django/django

View on GitHub

Showing 1,070 of 1,573 total issues

File qunit.js has 3181 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * QUnit 2.0.1
 * https://qunitjs.com/
 *
 * Copyright jQuery Foundation and other contributors
Severity: Major
Found in js_tests/qunit/qunit.js - About 1 wk to fix

    Function templatize has a Cognitive Complexity of 204 (exceeds 5 allowed). Consider refactoring.
    Open

    def templatize(src, origin=None):
        """
        Turn a Django template into something that is understood by xgettext. It
        does so by translating the Django translation tags into standard gettext
        function invocations.
    Severity: Minor
    Found in django/utils/translation/template.py - About 4 days 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 diff has 732 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    QUnit.diff = ( function() {
        function DiffMatchPatch() {
        }
    
        //  DIFF FUNCTIONS
    Severity: Major
    Found in js_tests/qunit/qunit.js - About 3 days to fix

      File autodetector.py has 1055 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import functools
      import re
      from itertools import chain
      
      from django.conf import settings
      Severity: Major
      Found in django/db/migrations/autodetector.py - About 2 days to fix

        Function _build_migration_list has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
        Open

            def _build_migration_list(self, graph=None):
                """
                Chop the lists of operations up into migrations with dependencies on
                each other. Do this by going through an app's list of operations until
                one is found that has an outgoing dependency that isn't in another
        Severity: Minor
        Found in django/db/migrations/autodetector.py - About 1 day 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

        File six.py has 662 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Utilities for writing code that runs on Python 2 and 3"""
        
        # Copyright (c) 2010-2015 Benjamin Peterson
        #
        # Permission is hereby granted, free of charge, to any person obtaining a copy
        Severity: Major
        Found in django/utils/six.py - About 1 day to fix

          Function handle_inspection has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_inspection(self, options):
                  connection = connections[options['database']]
                  # 'table_name_filter' is a stealth option
                  table_name_filter = options.get('table_name_filter')
          
          
          Severity: Minor
          Found in django/core/management/commands/inspectdb.py - About 1 day 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

          GEOSGeometryBase has 77 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class GEOSGeometryBase(GEOSBase):
          
              _GEOS_CLASSES = None
          
              ptr_type = GEOM_PTR
          Severity: Major
          Found in django/contrib/gis/geos/geometry.py - About 1 day to fix

            Function handle has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
            Open

                def handle(self, *args, **options):
                    username = options[self.UserModel.USERNAME_FIELD]
                    database = options['database']
            
                    # If not provided, create the user with an unusable password
            Severity: Minor
            Found in django/contrib/auth/management/commands/createsuperuser.py - About 1 day 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

            File options.py has 619 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import copy
            import inspect
            from bisect import bisect
            from collections import OrderedDict, defaultdict
            
            
            Severity: Major
            Found in django/db/models/options.py - About 1 day to fix

              File makemessages.py has 600 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import fnmatch
              import glob
              import os
              import re
              import sys
              Severity: Major
              Found in django/core/management/commands/makemessages.py - About 1 day to fix

                File geometry.py has 574 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                """
                 This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
                 inherit from this object.
                """
                import re
                Severity: Major
                Found in django/contrib/gis/geos/geometry.py - About 1 day to fix

                  File __init__.py has 567 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  """
                  LANG_INFO is a dictionary structure to provide meta information about languages.
                  
                  About name_local: capitalize it as if your language name was appearing
                  inside a sentence in your language.
                  Severity: Major
                  Found in django/conf/locale/__init__.py - About 1 day to fix

                    File dates.py has 554 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import datetime
                    
                    from django.conf import settings
                    from django.core.exceptions import ImproperlyConfigured
                    from django.db import models
                    Severity: Major
                    Found in django/views/generic/dates.py - About 1 day to fix

                      File geometries.py has 545 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      """
                       The OGRGeometry is a wrapper for using the OGR Geometry class
                       (see http://www.gdal.org/classOGRGeometry.html).  OGRGeometry
                       may be instantiated when reading geometries from OGR Data Sources
                       (e.g. SHP files), or when given OGC WKT (a string).
                      Severity: Major
                      Found in django/contrib/gis/gdal/geometries.py - About 1 day to fix

                        Function dump has 218 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        QUnit.dump = ( function() {
                            function quote( str ) {
                                return "\"" + str.toString().replace( /\\/g, "\\\\" ).replace( /"/g, "\\\"" ) + "\"";
                            }
                            function literal( o ) {
                        Severity: Major
                        Found in js_tests/qunit/qunit.js - About 1 day to fix

                          OGRGeometry has 60 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class OGRGeometry(GDALBase):
                              """Encapsulate an OGR geometry."""
                              destructor = capi.destroy_geom
                          
                              def __init__(self, geom_input, srs=None):
                          Severity: Major
                          Found in django/contrib/gis/gdal/geometries.py - About 1 day to fix

                            Function _ogrinspect has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=None,
                                            multi_geom=False, name_field=None, imports=True,
                                            decimal=False, blank=False, null=False):
                                """
                                Helper routine for `ogrinspect` that generates GeoDjango models corresponding
                            Severity: Minor
                            Found in django/contrib/gis/utils/ogrinspect.py - About 1 day 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 handle has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def handle(self, **options):
                            
                                    self.verbosity = options['verbosity']
                                    self.interactive = options['interactive']
                                    app_label = options['app_label']
                            Severity: Minor
                            Found in django/core/management/commands/squashmigrations.py - About 1 day 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 sort_dependencies has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def sort_dependencies(app_list):
                                """Sort a list of (app_config, models) pairs into a single list of models.
                            
                                The single list of models is sorted so that any model with a natural key
                                is serialized before a normal model, and any model with a natural key
                            Severity: Minor
                            Found in django/core/serializers/__init__.py - About 1 day 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