Showing 30 of 65 total issues
Function parse_element
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def parse_element(self, element):
mapping = {
'point': 'newpoint',
'linestring': 'newlinestring',
'polygon': 'newpolygon'
- 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 __init__.py
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
from copy import deepcopy
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.geos import GEOSException, GEOSGeometry
Function handle
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
layer_pk = options.get('layer_pk')
layer_name = options.get('layer-name') or uuid.uuid4()
file_path = options.get('file_path')
dryrun = options.get('dry_run')
- 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 handle
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
layer_pk = options.get('layer_pk')
layer_name = options.get('layer_name') or uuid.uuid4()
file_path = options.get('file_path')
dryrun = options.get('dry_run')
- 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 make_zipfile_bytesio
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def make_zipfile_bytesio(base_dir):
zip_file = io.BytesIO()
with zipfile.ZipFile(zip_file, "w",
compression=zipfile.ZIP_DEFLATED) as zf:
- 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 to_shapefile
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_shapefile(self):
if not self.features.count():
return
with TemporaryDirectory() as shape_folder:
shapes = {}
- 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 from_csv_dictreader
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_csv_dictreader(self, reader, pk_properties, options, operations,
Function filter_queryset
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def filter_queryset(self, request, queryset, view):
query = Q()
for param_name, param_value in request.query_params.items():
try:
field = (queryset.model
- 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 _get_layer_out
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_layer_out(self, pk, name, clear_output, verbosity):
if pk or name:
layer = self._get_layer_by_pk(pk) if pk else self._get_layer_by_name(name)
if clear_output:
layer.features.all().delete()
- 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 _initial_import_from_csv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _initial_import_from_csv(self, chunks, options, operations):
for chunk in chunks:
entries = []
for row in chunk:
feature_args = {
- 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 _complementary_import_from_csv
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _complementary_import_from_csv(self, chunks, options, operations,
Function wrapper
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def wrapper(self, x, y, z,
Function from_shapefile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def from_shapefile(self, zipped_shapefile_file, id_field=None):
""" Load ShapeFile content provided into a zipped archive.
zipped_shapefile_file -- a file-like object on the zipped content
id_field -- the field name used a identifier
- 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
Avoid deeply nested control flow statements. Open
if len(simple_object_coords) > 1:
# manage holes
polygon.innerboundaryis = (simple_object_coords[1], )
else:
Function handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
query = options.get('query')
layer_name = options.get('layer') or uuid.uuid4()
type_features = options.get('type')
layer_pk = options.get('layer_pk')
- 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 handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
for layer in Layer.objects.all():
if options['verbosity'] >= 1:
self.stdout.write(f'Generating {layer.name} tiles cache')
bbox = layer.features.aggregate(bbox=Extent('geom'))['bbox']
- 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 get_tile_for_layer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_tile_for_layer(self, layer, z, x, y, name=None, features_pk=None):
Function extra_geometry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def extra_geometry(self, request, id_extra_feature, *args, **kwargs):
Function _call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _call(self, python_callable_name, layer_ins, layer_out, **command_args):
Function extra_layer_geometry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def extra_layer_geometry(self, request, id_extra_layer, *args, **kwargs):