Showing 29 of 142 total issues
Function meth_gen
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def meth_gen(class_name='MyClass', name='some_method',
Function didyoumean_custom_exc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def didyoumean_custom_exc(shell, etype, evalue, tb, tb_offset=None):
Function suggest_nb_arg
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def suggest_nb_arg(value, frame, groups):
"""Get suggestions in case of NB ARGUMENT error."""
del value # unused param
func_name, expected, given = groups
given_nb = int(given)
- 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 suggest_attribute_is_other_obj
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def suggest_attribute_is_other_obj(attribute, type_str, frame):
"""Suggest that attribute correspond to another object.
This can happen in two cases:
- A misused builtin function
- 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 test_keyword_builtin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def test_keyword_builtin(self):
"""A few builtins (like int()) have a different error message."""
# NICE_TO_HAVE
# 'max', 'input', 'len', 'abs', 'all', etc have a specific error
# message and are not relevant here
- 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 suggest_invalid_syntax
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def suggest_invalid_syntax(value, frame, groups):
"""Get suggestions in case of INVALID_SYNTAX error."""
del frame, groups # unused param
alternatives = {
'<>': '!=',
- 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 suggest_attribute_synonyms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def suggest_attribute_synonyms(attribute, attributes):
"""Suggest that a method with a similar meaning was used.
Example: 'lst.add(e)' -> 'lst.append(e)'.
"""
- 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 register_suggestion_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def register_suggestion_for(error_type, regex):
"""Decorator to register a function to be called to get suggestions.
Parameters correspond to the fact that the registration is done for a
specific error type and if the error message matches a given regex
- 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_func_by_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_func_by_name(func_name, frame):
"""Get the function with the given name in the frame."""
# TODO: Handle qualified names such as dict.get
# Dirty workaround is to remove everything before the last '.'
func_name = func_name.split('.')[-1]
- 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"