monarch-initiative/N2V

View on GitHub
embiggen/visualizations/graph_visualizer.py

Summary

Maintainability
F
3 wks
Test Coverage

File graph_visualizer.py has 4976 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Module with embedding visualization tools."""
import functools
import inspect
import itertools
import math
Severity: Major
Found in embiggen/visualizations/graph_visualizer.py - About 2 wks to fix

    Function __init__ has 39 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in embiggen/visualizations/graph_visualizer.py - About 4 hrs to fix

      Function _plot_types has 20 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _plot_types(
      Severity: Major
      Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

        Function _plot_scatter has 20 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _plot_scatter(
        Severity: Major
        Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

          Function plot_node_types has 19 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def plot_node_types(
          Severity: Major
          Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

            Function _plot_node_metric has 19 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _plot_node_metric(
            Severity: Major
            Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

              Function plot_connected_components has 18 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def plot_connected_components(
              Severity: Major
              Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                Function plot_node_ontologies has 17 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def plot_node_ontologies(
                Severity: Major
                Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                  Function plot_node_squares has 17 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def plot_node_squares(
                  Severity: Major
                  Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                    Function plot_approximated_harmonic_centrality has 17 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def plot_approximated_harmonic_centrality(
                    Severity: Major
                    Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                      Function plot_node_degrees has 17 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def plot_node_degrees(
                      Severity: Major
                      Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                        Function plot_node_triangles has 17 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def plot_node_triangles(
                        Severity: Major
                        Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                          Function plot_approximated_closeness_centrality has 17 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def plot_approximated_closeness_centrality(
                          Severity: Major
                          Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                            Function _plot_positive_and_negative_edges_metric has 16 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def _plot_positive_and_negative_edges_metric(
                            Severity: Major
                            Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                              Function plot_edge_types has 16 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  def plot_edge_types(
                              Severity: Major
                              Found in embiggen/visualizations/graph_visualizer.py - About 2 hrs to fix

                                Function __init__ has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def __init__(
                                        self,
                                        graph: Union[Graph, str],
                                        support: Optional[Graph] = None,
                                        subgraph_of_interest: Optional[Graph] = None,
                                Severity: Minor
                                Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                  Function __init__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def __init__(
                                          self,
                                          graph: Union[Graph, str],
                                          support: Optional[Graph] = None,
                                          subgraph_of_interest: Optional[Graph] = None,
                                  Severity: Minor
                                  Found in embiggen/visualizations/graph_visualizer.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 plot_nodes has 15 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      def plot_nodes(
                                  Severity: Major
                                  Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                    Function plot_positive_and_negative_edges_euclidean_distance has 15 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                        def plot_positive_and_negative_edges_euclidean_distance(
                                    Severity: Major
                                    Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                      Function plot_positive_and_negative_edges_cosine_similarity has 15 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          def plot_positive_and_negative_edges_cosine_similarity(
                                      Severity: Major
                                      Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                        Function plot_positive_and_negative_edges_resource_allocation_index has 13 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            def plot_positive_and_negative_edges_resource_allocation_index(
                                        Severity: Major
                                        Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                          Function plot_positive_and_negative_edges_adamic_adar has 13 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              def plot_positive_and_negative_edges_adamic_adar(
                                          Severity: Major
                                          Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                            Function plot_positive_and_negative_edges_preferential_attachment has 13 arguments (exceeds 4 allowed). Consider refactoring.
                                            Open

                                                def plot_positive_and_negative_edges_preferential_attachment(
                                            Severity: Major
                                            Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                              Function plot_positive_and_negative_edges_jaccard_coefficient has 13 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  def plot_positive_and_negative_edges_jaccard_coefficient(
                                              Severity: Major
                                              Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                                Function plot_edge_weights has 13 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    def plot_edge_weights(
                                                Severity: Major
                                                Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                                  Function plot_edges has 12 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      def plot_edges(
                                                  Severity: Major
                                                  Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                                    Function _handle_notebook_display has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                                    Open

                                                        def _handle_notebook_display(
                                                            self, *args: List, caption: Optional[str] = None
                                                        ) -> Optional[Union[Tuple[Figure, Axes], Tuple[Figure, Axes, str]]]:
                                                            """Handles whether to display provided data in a Jupyter Notebook or return them.
                                                    
                                                    
                                                    Severity: Minor
                                                    Found in embiggen/visualizations/graph_visualizer.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 plot_positive_and_negative_edges has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        def plot_positive_and_negative_edges(
                                                    Severity: Major
                                                    Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                                      Function _plot_positive_and_negative_edges_distance_histogram has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                                      Open

                                                          def _plot_positive_and_negative_edges_distance_histogram(
                                                      Severity: Major
                                                      Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

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

                                                            def _plot_positive_and_negative_edges_metric_histogram(
                                                        Severity: Major
                                                        Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

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

                                                              def _plot_node_metric_distribution(
                                                          Severity: Major
                                                          Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

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

                                                                def fit_and_plot_all(
                                                            Severity: Major
                                                            Found in embiggen/visualizations/graph_visualizer.py - About 1 hr to fix

                                                              Function plot_positive_and_negative_edges_euclidean_distance_histogram has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                              Open

                                                                  def plot_positive_and_negative_edges_euclidean_distance_histogram(
                                                              Severity: Major
                                                              Found in embiggen/visualizations/graph_visualizer.py - About 50 mins to fix

                                                                Function plot_positive_and_negative_edges_cosine_similarity_histogram has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                    def plot_positive_and_negative_edges_cosine_similarity_histogram(
                                                                Severity: Major
                                                                Found in embiggen/visualizations/graph_visualizer.py - About 50 mins to fix

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

                                                                      def _get_edge_embedding(
                                                                  Severity: Minor
                                                                  Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                        def _plot_positive_and_negative_edges_distance(
                                                                    Severity: Minor
                                                                    Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                          def plot_square_distribution(
                                                                      Severity: Minor
                                                                      Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                            def plot_approximated_closeness_centrality_distribution(
                                                                        Severity: Minor
                                                                        Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                              def _fit_and_plot_all(
                                                                          Severity: Minor
                                                                          Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                                def plot_node_degree_distribution(
                                                                            Severity: Minor
                                                                            Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                                  def plot_triangle_distribution(
                                                                              Severity: Minor
                                                                              Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

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

                                                                                    def plot_approximated_harmonic_centrality_distribution(
                                                                                Severity: Minor
                                                                                Found in embiggen/visualizations/graph_visualizer.py - About 45 mins to fix

                                                                                  Function _get_positive_edges_embedding has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                  Open

                                                                                      def _get_positive_edges_embedding(
                                                                                  Severity: Minor
                                                                                  Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                    Function plot_positive_and_negative_adamic_adar_histogram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                    Open

                                                                                        def plot_positive_and_negative_adamic_adar_histogram(
                                                                                    Severity: Minor
                                                                                    Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                      Function plot_positive_and_negative_resource_allocation_index_histogram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                      Open

                                                                                          def plot_positive_and_negative_resource_allocation_index_histogram(
                                                                                      Severity: Minor
                                                                                      Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                        Function plot_positive_and_negative_preferential_attachment_histogram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                        Open

                                                                                            def plot_positive_and_negative_preferential_attachment_histogram(
                                                                                        Severity: Minor
                                                                                        Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                          Function _set_legend has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                          Open

                                                                                              def _set_legend(
                                                                                          Severity: Minor
                                                                                          Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                            Function fit_negative_and_positive_edges has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                            Open

                                                                                                def fit_negative_and_positive_edges(
                                                                                            Severity: Minor
                                                                                            Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                              Function fit_edges has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                              Open

                                                                                                  def fit_edges(
                                                                                              Severity: Minor
                                                                                              Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                                Function plot_edge_segments has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                Open

                                                                                                    def plot_edge_segments(
                                                                                                Severity: Minor
                                                                                                Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                                  Function _get_negative_edge_embedding has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                  Open

                                                                                                      def _get_negative_edge_embedding(
                                                                                                  Severity: Minor
                                                                                                  Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                                    Function plot_positive_and_negative_jaccard_coefficient_histogram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                    Open

                                                                                                        def plot_positive_and_negative_jaccard_coefficient_histogram(
                                                                                                    Severity: Minor
                                                                                                    Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                                      Function plot_edge_weight_distribution has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                      Open

                                                                                                          def plot_edge_weight_distribution(
                                                                                                      Severity: Minor
                                                                                                      Found in embiggen/visualizations/graph_visualizer.py - About 35 mins to fix

                                                                                                        Function get_heatmaps_comments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                        Open

                                                                                                            def get_heatmaps_comments(self, letters: Optional[List[str]] = None) -> str:
                                                                                                                """Returns description of the heatmaps for the provided letters."""
                                                                                                                if (
                                                                                                                    not self._show_heatmaps_description
                                                                                                                    or letters is not None
                                                                                                        Severity: Minor
                                                                                                        Found in embiggen/visualizations/graph_visualizer.py - About 25 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

                                                                                                        There are no issues that match your filters.

                                                                                                        Category
                                                                                                        Status