Showing 207 of 457 total issues
Avoid deeply nested control flow statements. Open
if cached is None:
db.session.rollback()
abort(404)
resource.latitude = cached.latitude
Avoid deeply nested control flow statements. Open
for value in assocValues:
arguments = {
'resource_id': resource.id,
'descriptor_id': descriptor.id,
keyword: value,
Avoid deeply nested control flow statements. Open
if descriptor.dtype == 'text':
association_class = TextAssociation
keyword = 'text'
# see if same descriptor already exists
if csv_storage.action == 'update':
Avoid deeply nested control flow statements. Open
if type(value) == list:
value = csv_friendly('; '.join(value))
else:
value = csv_friendly(value)
values.append(value)
Avoid deeply nested control flow statements. Open
if desc.descriptor.values[desc.option] in option_map[opt]:
number_of_options_found += 1
break
if number_of_options_found == len(list(option_map.keys())):
Avoid deeply nested control flow statements. Open
if desc.values:
values = desc.values
val = val.split(';')
Avoid deeply nested control flow statements. Open
for v in val:
if v.strip():
values.add(v.strip())
desc.values = values
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create(sugg_id):
suggestion = Suggestion.query.get(sugg_id)
if suggestion is None:
abort(404)
descriptors = Descriptor.query.all()
- 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 descriptor is not None and descriptor.name == form.required_option_descriptor.data:
req_opt_desc_const = RequiredOptionDescriptorConstructor(
name=descriptor.name,
values=descriptor.values
)
Consider simplifying this complex logical expression. Open
if (deltaY === -1 && isRowHeader(tableMap, currCell, x, y) ||
deltaX === -1 && isColumnHeader(tableMap, currCell, x, y)) {
blocked = true;
} else {
Function colorBackgroundImageContrast
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function colorBackgroundImageContrast(test, Case, options, $this, element) {
Function colorBackgroundGradientContrast
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function colorBackgroundGradientContrast(test, Case, options, $this, element) {
Function scanHeaders
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function scanHeaders(tableMap, x, y, deltaX, deltaY) {
Function colorElementBehindBackgroundImageContrast
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function colorElementBehindBackgroundImageContrast(test, Case, options, $this, element) {
Function colorFontContrast
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function colorFontContrast(test, Case, options, $this, element) {
Function colorElementBehindBackgroundGradientContrast
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function colorElementBehindBackgroundGradientContrast(test, Case, options, $this, element) {
Function colorElementBehindContrast
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function colorElementBehindContrast(test, Case, options, $this, element) {
Function change_option_values_index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def change_option_values_index(desc_id):
"""Shows the page to add/edit/remove a descriptor's option values."""
descriptor = Descriptor.query.get(desc_id)
if descriptor is None:
abort(404)
- 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 reset_password
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def reset_password(token):
"""Reset an existing user's password."""
if not current_user.is_anonymous():
return redirect(url_for('main.index'))
form = ResetPasswordForm()
- 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_associations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_associations(resource_id):
resource = Resource.query.get(resource_id)
associations = {} # map from descriptor name -> {descriptor value(s), descriptor type}
if resource is None:
return json.dumps(associations)
- 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"