Showing 109 of 109 total issues
Avoid deeply nested control flow statements. Open
Open
if author_graph[node['From'], to_addr] == 0:
author_graph.add_edge(node['From'], to_addr, weight=1)
else:
author_graph[node['From'], to_addr] += 1
Avoid deeply nested control flow statements. Open
Open
if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
discussion_graph.add_edge(*edge)
edge_file.close()
Avoid deeply nested control flow statements. Open
Open
if json_obj['Time'] < time_limit:
# print("\nFrom", json_obj['From'], "\nTo", json_obj['To'], "\nCc", json_obj['Cc'])
from_addr = email_re.search(json_obj['From'])
json_obj['From'] = from_addr.group(0) if from_addr is not None else json_obj['From']
json_obj['To'] = set(email_re.findall(json_obj['To']))
Avoid deeply nested control flow statements. Open
Open
if json_obj['Time'] < time_limit:
# print("\nFrom", json_obj['From'], "\nTo", json_obj['To'], "\nCc", json_obj['Cc'])
from_addr = email_re.search(json_obj['From'])
json_obj['From'] = from_addr.group(0) if from_addr is not None else json_obj['From']
json_obj['To'] = set(email_re.findall(json_obj['To']))
Avoid deeply nested control flow statements. Open
Open
if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
discussion_graph.add_edge(*edge)
edge_file.close()
Function test_generate_rt_curve_fits
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def test_generate_rt_curve_fits(mock_figure, mock_plot, mock_legend, mock_ylabel, mock_xlabel, mock_savefig):
Avoid deeply nested control flow statements. Open
Open
if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
try:
discussion_graph.node[edge[0]]['sender']
discussion_graph.node[edge[1]]['sender']
discussion_graph.add_edge(*edge)
Avoid deeply nested control flow statements. Open
Open
if json_obj['Time'] < time_limit:
# print("\nFrom", json_obj['From'], "\nTo", json_obj['To'], "\nCc", json_obj['Cc'])
from_addr = email_re.search(json_obj['From'])
json_obj['From'] = from_addr.group(0) if from_addr is not None else json_obj['From']
json_obj['To'] = set(email_re.findall(json_obj['To']))
Function test_generate_cl_curve_fits
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def test_generate_cl_curve_fits(mock_figure, mock_plot, mock_legend, mock_ylabel, mock_xlabel, mock_savefig):
Avoid deeply nested control flow statements. Open
Open
if not jfile['References'] == "":
# The references are stored as a comma separated string. We have to split it at the ',' to get a list.
if ref_toggle:
ref_list = jfile['References'].split(',')
else:
Avoid deeply nested control flow statements. Open
Open
if not console_output:
out_file.write(author_email + "\n")
author_features = list()
for i in indices:
author_features.append(feature_names[i])
Function remove_duplicate_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def remove_duplicate_headers(self,to_remove=duplicate_uid, json_headers="headers.json", output_file="headers.json"):
"""
This function removes all the duplicate entries of the UIDs specified in the to_remove parameter. By default,
it removes all the duplicate entries in the JSON file.
- 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 replace_invalid_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def replace_invalid_headers(self,to_replace=invalid_uid, json_headers="headers.json", output_file="headers.json", unwanted_uid_filename="unwanted_uid.txt", uid_map_filename="thread_uid_map.json"):
"""
This function removes the mail headers that have insufficient attributes and fetches those headers again.
If an attribute is missing in the original mail header or if the mail has been deleted, this function ignores that UID.
- 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
Open
if isinstance(response_part, tuple):
# response_part contains the required info as a byte stream. This has to be converted to a message stream.
# This is done using the email module
original = email.message_from_bytes(response_part[1])
Avoid deeply nested control flow statements. Open
Open
if author_graph[node['From'], to_addr] == 0:
author_graph.add_edge(node['From'], to_addr, weight=1)
else:
author_graph[node['From'], to_addr] += 1
if node['Cc'] is None:
Avoid deeply nested control flow statements. Open
Open
if edge[0] in msgs_in_range and edge[1] in msgs_in_range:
discussion_graph.add_edge(*edge)
edge_file.close()
Function generate_wh_table_threads
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def generate_wh_table_threads(nodelist_filename, edgelist_filename, output_filename, ignore_lat=False, time_limit=None):
Function replace_invalid_headers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def replace_invalid_headers(self,to_replace=invalid_uid, json_headers="headers.json", output_file="headers.json", unwanted_uid_filename="unwanted_uid.txt", uid_map_filename="thread_uid_map.json"):
Function add_to_weighted_graph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def add_to_weighted_graph(graph_obj, discussion_graph, json_data, nbunch, node_enum=list()):
Function weighted_multigraph
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def weighted_multigraph(graph_nodes, graph_edges, clean_data, output_dir, ignore_lat = False):