django/django

View on GitHub
django/contrib/gis/geos/geometry.py

Summary

Maintainability
F
3 days
Test Coverage

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

class GEOSGeometryBase(GEOSBase):
    _GEOS_CLASSES = None

    ptr_type = GEOM_PTR
    destructor = capi.destroy_geom
Severity: Major
Found in django/contrib/gis/geos/geometry.py - About 1 day to fix

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

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

      Function __init__ has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, geo_input, srid=None):
              """
              The base constructor for GEOS geometry objects. It may take the
              following inputs:
      
      
      Severity: Minor
      Found in django/contrib/gis/geos/geometry.py - About 2 hrs 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 transform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def transform(self, ct, clone=False):
              """
              Requires GDAL. Transform the geometry according to the given
              transformation object, which may be an integer SRID, and WKT or
              PROJ string. By default, transform the geometry in-place and return
      Severity: Minor
      Found in django/contrib/gis/geos/geometry.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 buffer_with_style has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def buffer_with_style(
      Severity: Minor
      Found in django/contrib/gis/geos/geometry.py - About 35 mins to fix

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

            def __init__(self, ptr, cls):
                self._ptr = ptr
        
                # Setting the class type (e.g., Point, Polygon, etc.)
                if type(self) in (GEOSGeometryBase, GEOSGeometry):
        Severity: Minor
        Found in django/contrib/gis/geos/geometry.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

        There are no issues that match your filters.

        Category
        Status