Showing 1,782 of 2,090 total issues
OGRGeometry
has 65 functions (exceeds 20 allowed). Consider refactoring. Open
class OGRGeometry(GDALBase):
"""Encapsulate an OGR geometry."""
destructor = capi.destroy_geom
File response.py
has 554 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import io
import json
import mimetypes
import os
Function collect
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
def collect(
self,
objs,
source=None,
nullable=False,
- Read upRead up
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 debug.py
has 548 lines of code (exceeds 250 allowed). Consider refactoring. Open
import functools
import inspect
import itertools
import re
import sys
Function generate_created_models
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def generate_created_models(self):
"""
Find all new models (both managed and unmanaged) and make create
operations for them as well as separate operations to create any
foreign key or M2M relationships (these are optimized later, if
- Read upRead up
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 names_to_path
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def names_to_path(self, names, opts, allow_many=True, fail_on_missing=False):
"""
Walk the list of names and turns them into PathInfo tuples. A single
name in 'names' can generate multiple PathInfos (m2m, for example).
- Read upRead up
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 hashers.py
has 545 lines of code (exceeds 250 allowed). Consider refactoring. Open
import base64
import binascii
import functools
import hashlib
import importlib
File multipartparser.py
has 544 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
File layermapping.py
has 539 lines of code (exceeds 250 allowed). Consider refactoring. Open
# LayerMapping -- A Django Model/OGR Layer Mapping Utility
"""
The LayerMapping class provides a way to map the contents of OGR
vector files (e.g. SHP files) to Geographic-enabled Django models.
Function get_aggregation
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def get_aggregation(self, using, aggregate_exprs):
"""
Return the dictionary with the values of the existing aggregations.
"""
if not aggregate_exprs:
- Read upRead up
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 detect_soft_applied
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
def detect_soft_applied(self, project_state, migration):
"""
Test whether a migration has been implicitly applied - that the
tables or columns it would create exist. This is intended only for use
on initial migrations (as it only looks for CreateModel and AddField).
- Read upRead up
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 validators.py
has 524 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ipaddress
import math
import re
from pathlib import Path
from urllib.parse import urlsplit, urlunsplit
File autoreload.py
has 522 lines of code (exceeds 250 allowed). Consider refactoring. Open
import itertools
import logging
import os
import signal
import subprocess
File main.py
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
import warnings
from datetime import datetime, timedelta
from django import forms
from django.conf import settings
Function serialize
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def serialize(self):
def _write(_arg_name, _arg_value):
if _arg_name in self.operation.serialization_expand_args and isinstance(
_arg_value, (list, tuple, dict)
):
- Read upRead up
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 utils.py
has 505 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import decimal
import json
from collections import defaultdict
from functools import reduce
File json.py
has 501 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
from django import forms
from django.core import checks, exceptions
from django.db import NotSupportedError, connections, router
File i18n.py
has 498 lines of code (exceeds 250 allowed). Consider refactoring. Open
from decimal import Decimal
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError, Variable
from django.template.base import TokenType, render_value_in_context
Function sort_dependencies
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def sort_dependencies(app_list, allow_cycles=False):
"""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
- Read upRead up
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 trans_real.py
has 493 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Translation helper functions."""
import functools
import gettext as gettext_module
import os