Showing 45 of 45 total issues
Function run_validator_group
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_validator_group(validator_group, validator_arguments, post_error_validator_group=None):
successful_group_names = []
for group_name, group in validator_group.items():
errors = _run_validator_group(group, validator_arguments)
if errors:
- 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 mutable_default_arguments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mutable_default_arguments(project_folder, *args, **kwargs):
funcdef_types = (ast.FunctionDef, )
mutable_types = (ast.List, ast.Dict)
for parsed_file in project_folder.get_parsed_py_files():
for funcdef in ast_helpers.get_nodes_of_type(parsed_file.ast_tree, funcdef_types):
- 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 file_has_bom
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def file_has_bom(project_path, directories_to_skip, *args, **kwargs):
for root, dirs, filenames in os.walk(project_path):
dirs[:] = [
d for d in dirs
if d not in directories_to_skip
- 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 urls_with_hardcoded_get_parameters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def urls_with_hardcoded_get_parameters(project_folder, *args, **kwargs):
for parsed_file in project_folder.get_parsed_py_files():
string_nodes = [n for n in ast.walk(parsed_file.ast_tree) if isinstance(n, ast.Str)]
for string_node in string_nodes:
if url_helpers.is_url_with_params(string_node.s):
- 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 file_not_in_utf8
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def file_not_in_utf8(project_path, directories_to_skip, *args, **kwargs):
for root, dirs, filenames in os.walk(project_path):
dirs[:] = [
d for d in dirs
if d not in directories_to_skip
- 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"