prasadtalasila/IRCLogParser

View on GitHub

Showing 95 of 95 total issues

Function truncate_table has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def truncate_table(table, cutoff_percentile):

    """
    The calculations of conversation characteristics, namely RT, CL and CRT, are
    based on the cutoff values estimated for RT and CL. This generic function takes
Severity: Minor
Found in lib/analysis/channel.py - About 1 hr to fix

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            out_degree_fit_parameters[dt.month-1] = vis.generate_log_plots(degree_anal_message_number["out_degree"]["raw_for_vis"], output_directory, channel_name_iter[0])
Severity: Major
Found in lib/validate.py and 2 other locations - About 1 hr to fix
lib/validate.py on lines 84..84
lib/validate.py on lines 85..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            in_degree_fit_parameters[dt.month-1] = vis.generate_log_plots(degree_anal_message_number["in_degree"]["raw_for_vis"], output_directory, channel_name_iter[0])
Severity: Major
Found in lib/validate.py and 2 other locations - About 1 hr to fix
lib/validate.py on lines 83..83
lib/validate.py on lines 85..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        msg_igraph, msg_community = community.infomap_igraph(ig_graph=None, net_file_location= output_directory + "message-exchange-" + str(dt.month) + '.net')
Severity: Major
Found in lib/validate.py and 1 other location - About 1 hr to fix
lib/validate.py on lines 174..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            msg_igraph, msg_community = community.infomap_igraph(ig_graph=None, net_file_location= output_directory + "message-exchange-" + str(dt.month) + '.net')
Severity: Major
Found in lib/validate.py and 1 other location - About 1 hr to fix
lib/validate.py on lines 189..189

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function codelengths has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def codelengths(log_directory, output_directory, channel_name, start_date, end_date):
    """
        The function iterate through the months in the given date range and computes the infomap number. It then plots a
        box plot for the infomap numbers of all the whole months in the given time period.

Severity: Minor
Found in lib/validate.py - About 1 hr to fix

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 build_conversation has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def build_conversation(rec_list, nick, send_time, nick_to_search,
Severity: Major
Found in lib/analysis/channel.py - About 1 hr to fix

Function conv_helper has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def conv_helper(rec, nick, send_time, nick_to_search, nick_receiver,
Severity: Major
Found in lib/analysis/channel.py - About 1 hr to fix

Function extend_conversation_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def extend_conversation_list(nick_sender, nick_receiver, conversation):
    """ A functions that takes the nick_sender and nick_reciver and add them
        the conversation list and increase the weight.
        Args:
            nick_sender : nick of user sending a message
Severity: Minor
Found in lib/util.py - About 1 hr to fix

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 build_graphs has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def build_graphs(nick_sender, nick_receiver, time, year, month, day, day_graph, aggr_graph):
Severity: Major
Found in lib/util.py - About 1 hr to fix

Function resp_helper has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def resp_helper(rec, nick, send_time, nick_to_search, nick_receiver, nick_sender, conversations, conn_comp_list):
Severity: Major
Found in lib/analysis/channel.py - About 1 hr to fix

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                conv_len_curve_fit_parameters[dt.month - 1] = vis.exponential_curve_fit_and_plot(conv_len, output_directory,
                                                                                              "conv_len_cutoff" + str(cutoff))
Severity: Major
Found in lib/validate.py and 2 other locations - About 55 mins to fix
lib/validate.py on lines 283..284
lib/validate.py on lines 285..287

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                conv_ref_time_curve_fit_parameters[dt.month - 1] = vis.exponential_curve_fit_and_plot_x_shifted(conv_ref_time,
                                                                                                             output_directory,
                                                                                                             "conv_ref_time_cutoff" + str(cutoff))
Severity: Major
Found in lib/validate.py and 2 other locations - About 55 mins to fix
lib/validate.py on lines 281..282
lib/validate.py on lines 283..284

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function correlational_CL_RT_CRT has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def correlational_CL_RT_CRT(log_directory, output_directory, start_date, end_date):
    """
        Correlational : statistical distribution as illustrated by box plot for RT, CL, CRT parameters. The function
        takes the given time duration and selects one month at a time for generation of a degree distribution sample. Each
        degree distribution sample shall have 3 curve fit parameters namely a,b & c. The function collects these parameters
Severity: Minor
Found in lib/validate.py - About 55 mins to fix

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

                resp_time_curve_fit_parameters[dt.month - 1] = vis.exponential_curve_fit_and_plot(truncated_rt, output_directory,
                                                                                               "resp_time_cutoff" + str(cutoff))
Severity: Major
Found in lib/validate.py and 2 other locations - About 55 mins to fix
lib/validate.py on lines 281..282
lib/validate.py on lines 285..287

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid deeply nested control flow statements.
Open

                        while earlier_line_no >= 0: #to find the line just before "=="" so as to find time of Nick Change
                            earlier_line_no = earlier_line_no - 1
                            if(day_log[earlier_line_no][0] != '='):
                                year, month, day = util.get_year_month_day(day_content)
                                today_nick_change_graph, aggregate_nick_change_graph = util.build_graphs(nick1, nick2, day_log[earlier_line_no][1:6], year, month, day, today_nick_change_graph, aggregate_nick_change_graph)
Severity: Major
Found in lib/analysis/user.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if fr:
                        user_words_dict.append({'sender':nick_sender, 'words':word_list_lemmatized }) 

Severity: Major
Found in lib/analysis/user.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        for ind in order_centroids[i, :config.SHOW_N_WORDS_PER_CLUSTER]:
                                outfile.write(' %s\n' % terms[ind])
                        outfile.write("\n")
Severity: Major
Found in lib/analysis/user.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if f:
                        user_nick = user

Severity: Major
Found in lib/nickTracker.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                    if flag:
                        nick_channel_dict.append({'nickname':user_nick, 'channels': [[channel_name, 1]]})
                        considered_nicks.append(user_nick)

Severity: Major
Found in lib/nickTracker.py - About 45 mins to fix
Severity
Category
Status
Source
Language