DeveloperCAP/MLCAT

View on GitHub

Showing 81 of 109 total issues

Function test_generate_crt_curve_fits has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def test_generate_crt_curve_fits(mock_figure, mock_plot, mock_legend, mock_ylabel, mock_xlabel, mock_savefig):
Severity: Minor
Found in test/integration_test/lib/analysis/author/test_curve_fiting.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if time_lbound <= json_obj['Time'] < time_ubound:
                            # 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']))
    Severity: Major
    Found in lib/analysis/author/time_statistics.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if console_output:
                                  print("\n-----\n")
                              else:
                                  out_file.write("\n-----\n")
                  # with open("author_top_index.json", 'w') as json_file:
      Severity: Major
      Found in lib/input/mbox/keyword_digest.py - About 45 mins to fix

        Function remove_unwanted_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def remove_unwanted_headers(self, to_remove=unwanted_uid, json_headers="headers.json", output_file="headers.json"):
                """
        
                This function removes all the UIDs specified in the to_remove parameter. By default, it removes all the unwanted
                entries in the JSON file, i.e. the list of UIDs of mails that are not forwarded from LKML subscription.
        Severity: Minor
        Found in lib/input/check_headers.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                            if to_addr not in author_map:
                                author_map[to_addr] = index
                                author_graph.add_vertex(name=to_addr, label=to_addr)
                                index += 1
                            if author_graph[node['From'], to_addr] == 0:
        Severity: Major
        Found in lib/analysis/author/community.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
                                  discussion_graph.add_edge(*edge)
                      edge_file.close()
          Severity: Major
          Found in lib/analysis/thread/wh_table.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if time_lbound <= json_obj['Time'] < time_ubound:
                                    # 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']))
            Severity: Major
            Found in lib/analysis/author/ranking.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
                                      discussion_graph.add_edge(*edge)
                          edge_file.close()
              Severity: Major
              Found in lib/analysis/author/time_statistics.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if to_addr not in author_map:
                                        author_map[to_addr] = index
                                        author_graph.add_vertex(name=to_addr, label=to_addr)
                                        index += 1
                                    if author_graph[node['From'], to_addr] == 0:
                Severity: Major
                Found in lib/analysis/author/community.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if time_lbound <= json_obj['Time'] < time_ubound:
                                          # 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']))
                  Severity: Major
                  Found in lib/analysis/thread/message_activity.py - About 45 mins to fix

                    Function generate_hyperedge_distribution has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def generate_hyperedge_distribution(nodelist_filename, edgelist_filename, clean_headers_filename, foldername, time_limit=None, ignore_lat=False):
                    Severity: Minor
                    Found in lib/analysis/thread/hypergraph.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
                                              discussion_graph.add_edge(*edge)
                                  edge_file.close()
                      Severity: Major
                      Found in lib/analysis/thread/ps_table.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if not console_output:
                                                    out_file.write(author_email + "\n")
                                                    author_features = list()
                                                    for i in indices:
                                                        author_features.append(feature_names[i])
                        Severity: Major
                        Found in lib/input/mbox/keyword_digest.py - About 45 mins to fix

                          Function vertex_clustering has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def vertex_clustering(json_filename, nodelist_filename, edgelist_filename, foldername, time_limit=None, ignore_lat=False):
                          Severity: Minor
                          Found in lib/analysis/author/community.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            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
                            
                            
                            Severity: Major
                            Found in lib/analysis/author/community.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
                                                      discussion_graph.add_edge(*edge)
                                          edge_file.close()
                              Severity: Major
                              Found in lib/analysis/author/graph/interaction.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                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']))
                                Severity: Major
                                Found in lib/analysis/author/edge_list.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  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']))
                                  Severity: Major
                                  Found in lib/analysis/author/community.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if edge[0] in msgs_before_time and edge[1] in msgs_before_time:
                                                            discussion_graph.add_edge(*edge)
                                                edge_file.close()
                                    Severity: Major
                                    Found in lib/analysis/thread/hypergraph.py - About 45 mins to fix

                                      Function test_generate_rt_curve_fits has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      def test_generate_rt_curve_fits(mock_figure, mock_plot, mock_legend, mock_ylabel, mock_xlabel, mock_savefig):
                                      Severity: Minor
                                      Found in test/integration_test/lib/analysis/author/test_curve_fiting.py - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language