Showing 43 of 45 total issues
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"