Showing 34 of 34 total issues
File nexgddp_router.py
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""API ROUTER"""
import io
import logging
import os
Function query
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def query(dataset_id, bbox, dataset):
"""NEXGDDP QUERY ENDPOINT"""
logging.info('[ROUTER] Doing Query of dataset ' + dataset_id)
# Get and deserialize
table_name = dataset.get('tableName')
- 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 query_service.py
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""QUERY SERVICE"""
import logging
import os
import tempfile
Function get_fields
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def get_fields(xml):
logging.info('[XMLService] Parsing XML fields')
fields = {}
try:
root = ET.fromstring(xml)
- 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
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_tile(z, x, y, model, scenario, year, style, indicator, layer, compare_year=None, dset_b=None, no_data=None):
Function get_sql_select
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_sql_select(json_sql):
select_sql = json_sql.get('select')
logging.debug(f"select_sql: {select_sql}")
select_sql
select = None
- 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_domain
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_domain(xml):
logging.info('[XMLService] Parsing XML domain info')
domain = {}
try:
root = ET.fromstring(xml)
- 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_diff_query
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_tile_diff_query(bbox, year, model, scenario, indicator, bounds, year_b, dset_b):
Function diff
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def diff(dset_a, date_a, date_b, lat, lon, varnames, dset_b=None):
Function upload_file
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def upload_file(filename, layer, z, x, y, year, compare_year, dset_b):
Avoid deeply nested control flow statements. Open
for field_spec in field.findall('{http://www.opengis.net/swe/2.0}Quantity'):
for field_spec_uom in field_spec.findall('{http://www.opengis.net/swe/2.0}uom'):
fields[field_name] = {
'type': 'number',
'uom': field_spec_uom.get('code')
Function get_diff_value
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_diff_value(dset_a, date_a, date_b, lat, lon, varnames, dset_b):
Function get_all_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_all_data(scenario, model, years, bbox):
logging.info('[QueryService] Getting * data from rasdaman')
year_min = sorted(years)[0]
year_max = sorted(years)[-1]
results = []
- 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_tile_cache_key
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_tile_cache_key(layer, z, x, y, year, compare_year=None, dset_b=None):
Function get_stats
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_stats(scenario, model, years, indicator, bbox, function):
Function get_tile_query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_tile_query(bbox, year, model, scenario, indicator, bounds):
Function get_tile_mask_query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_tile_mask_query(bbox, year, model, scenario, indicator, no_data):
Function get_dataset_from_id
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_dataset_from_id(func):
@wraps(func)
def wrapper(*args, **kwargs):
logging.debug("Getting dataset from id")
- 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_attrs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_tile_attrs(func):
"""Get style"""
@wraps(func)
def wrapper(*args, **kwargs):
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_tile(z, x, y, model, scenario, year, style, indicator, layer, compare_year=None, dset_b=None, no_data=None):
logging.info(f'Getting tile for {z} {x} {y}')
logging.debug(compare_year)
bbox = TileService.get_bbox(x, y, z)
logging.debug(f"bbox: {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"