Showing 294 of 518 total issues
Avoid deeply nested control flow statements. Open
if not ticket.get('logged', False):
self.log_user_access(AccessType.download_file, cont_name=cont_name, cont_id=cid, filename=fileinfo['name'])
config.db.downloads.update_one({'_id': ticket_id}, {'$set': {'logged': True}})
else:
Avoid deeply nested control flow statements. Open
if isinstance(v, list):
v.remove("null")
elif isinstance(v, str):
v = None
null_filter = {
Function _resolveRef
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
SchemaTranspiler.prototype._resolveRef = function(schema, defs) {
var m, ref;
if( !defs ) {
if( schema.$ref ) {
- 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( this.defNames[k] ) {
errors.push(new LintError('Duplicate definition found: "' + k + '"', filename));
}
Function get_rules_for_container
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_rules_for_container(db, container):
"""
Recursively walk the hierarchy until the project object is found.
"""
- 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 not isinstance(cf[x], bool):
r['target']['env']['FW_CONFIG_' + config_name] = str(cf[x])
else:
r['target']['env']['FW_CONFIG_' + config_name] = str(cf[x]).lower()
Avoid deeply nested control flow statements. Open
if len(k.split('.')) > 1:
null_filter['bool']['should'][0]['bool']['must'].append({'exists': {'field': k.split('.')[0]}})
if v:
Function build
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build(self):
query = {}
if self.uid:
query['origin.id'] = self.uid
- 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 parsed_url.port != 443:
api_key = parsed_url.hostname + ':' + str(parsed_url.port) + ':' + api_key
else:
api_key = parsed_url.hostname + ':' + api_key
Avoid deeply nested control flow statements. Open
if cached_gears.get(gear_id, None) is not None:
gear_name = cached_gears[gear_id]
else:
gear_id_bson = bson.ObjectId(gear_id)
gear = config.db.gears.find_one({'_id': gear_id_bson})
Function aggregate_field_values
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def aggregate_field_values(self):
"""
Return list of type ahead values for a key given a value
that the user has already started to type in for the value of
a custom string field or a set of statistics if the field type is
- 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 j.origin['type'] != 'user':
raise Exception('Cannot provide an API key to a job not launched by a user')
Avoid deeply nested control flow statements. Open
if last > fileinfo['size']:
length = fileinfo['size'] - first
else:
length = last - first + 1
Avoid deeply nested control flow statements. Open
if y.get('_id') == self.uid:
ok = True
break
else:
Avoid deeply nested control flow statements. Open
if match is None:
raise Exception("No type " + match_type + " found for alg rule " + alg_name + " that should have been satisfied")
inputs[input_name] = FileReference(type=container_type, id=str(container['_id']), name=match['name'])
Function get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get(self, cont_name, **kwargs):
_id = kwargs.get('cid')
self.config = self.container_handler_configurations[cont_name]
self.storage = self.config['storage']
container = self._get_container(_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 f
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def f(method, _id, query_params=None, payload=None, fileinfo=None, exclude_params=None):
Function validateTemplateArgs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function validateTemplateArgs(tmplpath, template, args) {
var i, param;
if( !template || !template.parameters ) {
return;
}
- 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 _initialize_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _initialize_request(self, cont_name, list_name, _id, query_params=None):
"""
This method loads:
1) the container that will be modified
2) the storage class that will handle the database actions
- 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 v:
null_filter['bool']['should'].append({'terms': {k+'.raw': v}})
modified_filters.append(null_filter)