Function message_number_graph
has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring. Open
def message_number_graph(log_dict, nicks, nick_same_list, DAY_BY_DAY_ANALYSIS=False):
"""
Creates a directed graph
with each node representing an IRC user
and each directed edge has a weight which
- Read upRead up
- Create a ticketCreate a ticket
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
File network.py
has 617 lines of code (exceeds 250 allowed). Consider refactoring. Open
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import re
import networkx as nx
- Create a ticketCreate a ticket
Function message_time_graph
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def message_time_graph(log_dict, nicks, nick_same_list, DAY_BY_DAY_ANALYSIS=False):
""" creates a directed graph where each edge denotes a message sent from a user to another user
with the stamp denoting the time at which the message was sent
Args:
- Read upRead up
- Create a ticketCreate a ticket
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 message_number_bins_csv
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def message_number_bins_csv(log_dict, nicks, nick_same_list):
""" creates a CSV file which tracks the number of message exchanged in a channel
for 48 bins of half an hour each distributed all over the day
aggragated over the year.
- Read upRead up
- Create a ticketCreate a ticket
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 channel_user_presence_graph_and_csv
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def channel_user_presence_graph_and_csv(nicks, nick_same_list, channels_for_user, nick_channel_dict, nicks_hash, channels_hash):
""" creates a directed graph for each nick,
each edge from which points to the IRC Channels that nick has participated in.
(Nick changes are tracked here and only the initial nick is shown if a user changed his nick)
- Read upRead up
- Create a ticketCreate a ticket
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 channel_user_presence_graph_and_csv
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def channel_user_presence_graph_and_csv(nicks, nick_same_list, channels_for_user, nick_channel_dict, nicks_hash, channels_hash):
""" creates a directed graph for each nick,
each edge from which points to the IRC Channels that nick has participated in.
(Nick changes are tracked here and only the initial nick is shown if a user changed his nick)
- Create a ticketCreate a ticket
Function degree_analysis_on_graph
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def degree_analysis_on_graph(nx_graph, date=None, directed = True):
"""
perform degree analysis of input graph object
Arguments:
- Read upRead up
- Create a ticketCreate a ticket
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 identify_hubs_and_experts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def identify_hubs_and_experts(log_dict, nicks, nick_same_list):
"""
uses message_number graph to identify hubs and experts in the network
Args:
- Read upRead up
- Create a ticketCreate a ticket
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
if(line[0] != '=' and "] <" in line and "> " in line):
m = re.search(r"\<(.*?)\>", line)
nick_spliced = util.correctLastCharCR(m.group(0)[1:-1])
for messager in nicks:
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for nick_name in nicks:
rec_list = [e.strip() for e in line.split(':')] #receiver list splited about :
rec_list = util.rec_list_splice(rec_list)
if not rec_list[1]: #index 0 will contain time 14:02
break
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for nick in nicks:
rec_list = [e.strip() for e in line.split(':')]
rec_list = util.rec_list_splice(rec_list)
if not rec_list[1]:
break
- Create a ticketCreate a ticket
Function msg_no_analysis_helper
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def msg_no_analysis_helper(rec_list, corrected_nick, nick, conn_comp_list,conversations,today_conversation):
- Create a ticketCreate a ticket
Function channel_user_presence_graph_and_csv
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def channel_user_presence_graph_and_csv(nicks, nick_same_list, channels_for_user, nick_channel_dict, nicks_hash, channels_hash):
- Create a ticketCreate a ticket
Function add_channel_weighted_edge
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_channel_weighted_edge(graph, adjlist, nicks_hash, channels_hash, channel):
- Create a ticketCreate a ticket
Function bin_increment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def bin_increment(nick_name, messager, nick_spliced, bins, bin_index):
- Create a ticketCreate a ticket
Error: Missing parentheses in call to 'print'. Did you mean print(int "\nBuilding graph object with EDGE WEIGHT THRESHOLD:", config.THRESHOLD_MESSAGE_NUMBER_GRAPH)? (<unknown>, line 104)</unknown> Open
print "\nBuilding graph object with EDGE WEIGHT THRESHOLD:", config.THRESHOLD_MESSAGE_NUMBER_GRAPH
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
We encountered an error attempting to analyze this line.