Showing 43 of 45 total issues
File defaults.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os.path
from collections import OrderedDict
from types import MappingProxyType
from . import pre_validation_checks
Function data_in_repo
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def data_in_repo(project_folder, data_directories, *args, **kwargs):
if not project_folder.repo:
return
for directory in project_folder.enumerate_directories():
for data_directory in data_directories:
- 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 except_block_class_too_broad
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def except_block_class_too_broad(project_folder, *args, **kwargs):
exception_type_to_catch = 'Exception'
for parsed_file in project_folder.get_parsed_py_files():
tryes = [node for node in ast.walk(parsed_file.ast_tree) if isinstance(node, ast.ExceptHandler)]
for try_except in tryes:
- 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_too_long
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def file_too_long(project_path, max_number_of_lines, 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 exit_call_in_function
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def exit_call_in_function(project_folder, functions_allowed_to_have_exit_calls, *args, **kwargs):
for parsed_file in project_folder.get_parsed_py_files():
defs = ast_helpers.get_nodes_of_type(parsed_file.ast_tree, ast.FunctionDef)
for function_definition in defs:
if function_definition.name in functions_allowed_to_have_exit_calls:
- 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 tabs_used_for_indentation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def tabs_used_for_indentation(project_folder, directories_to_skip, *args, **kwargs):
frontend_extensions = ['.html', '.css', '.js']
relevant_extensions = frontend_extensions + ['.py']
files_info = project_folder.get_source_file_contents(relevant_extensions, directories_to_skip)
if not files_info:
- 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 return_with_parenthesis
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def return_with_parenthesis(project_folder, *args, **kwargs):
for parsed_file in project_folder.get_parsed_py_files():
file_content = parsed_file.content.split('\n')
return_lines = [n.lineno for n in ast.walk(parsed_file.ast_tree) if isinstance(n, ast.Return)]
for line_num in return_lines:
- 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 run_if_tokens_satisfy_condition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_if_tokens_satisfy_condition(tokens, condition):
def validator_decorator(func):
@wraps(func)
def func_wrapper(*args, **kwargs):
repo_token = kwargs.get('validator_token')
- 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 repo_is_too_large
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def repo_is_too_large(
Function get_all_namedtuple_names
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_all_namedtuple_names(tree):
nametuples_names = []
for node in ast.walk(tree):
if not isinstance(node, ast.Assign):
continue
- 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 count_pep8_violations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def count_pep8_violations(repository_info, max_line_length=79, path_whitelist=None):
path_whitelist = path_whitelist or []
pep8style = pep8.StyleGuide(
paths=['--max-line-length', str(max_line_length)],
quiet=True
- 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 too_many_pep8_violations
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def too_many_pep8_violations(
Function call_with_constants
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call_with_constants(project_folder, valid_calls_with_constants, *args, **kwargs):
for parsed_file in project_folder.get_parsed_py_files():
if 'tests' in parsed_file.path: # tests can have constants in asserts
continue
calls = ast_helpers.get_nodes_of_type(parsed_file.ast_tree, ast.Call)
- 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 code_too_nested
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def code_too_nested(project_folder, tab_size, max_indentation_level, deep_nesting_paths_to_ignore, *args, **kwargs):
Function has_local_var_named_as_global
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def has_local_var_named_as_global(project_folder, local_var_named_as_global_paths_to_ignore, max_indentation_level, *args, **kwargs):
Function commit_messages_from_blacklist
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def commit_messages_from_blacklist(project_folder, bad_commit_messages, last_commits_to_check_amount, *args, **kwargs):
Function has_variables_from_blacklist
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def has_variables_from_blacklist(project_folder, bad_variables_paths_to_ignore, bad_variable_names, *args, **kwargs):
Function camel_case_variable_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def camel_case_variable_name(project_folder, valid_non_snake_case_left_hand_values, valid_non_snake_case_right_hand_values, *args, **kwargs):
Function readme_not_changed
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def readme_not_changed(project_folder, readme_filename, original_project_folder=None, *args, **kwargs):
Function file_too_long
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def file_too_long(project_path, max_number_of_lines, directories_to_skip, *args, **kwargs):