ejplatform/ej-server

View on GitHub
src/ej_dataviz/roles.py

Summary

Maintainability
A
3 hrs
Test Coverage

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

def prepare_dataframe(df, id="stats-table", pc=False):
    """
    Renders dataframe in a HTML table.
    """
    if pc is True:
Severity: Minor
Found in src/ej_dataviz/roles.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 conversation_download_data has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def conversation_download_data(conversation, *, which, formats=None, cluster=None, **url_kwargs):
Severity: Minor
Found in src/ej_dataviz/roles.py - About 45 mins to fix

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

    def stats_table(conversation, stats=None, data="votes", request=None, **kwargs):
    Severity: Minor
    Found in src/ej_dataviz/roles.py - About 35 mins to fix

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

      def render_dataframe(df, index=False, *, col_display=None, **kwargs):
      Severity: Minor
      Found in src/ej_dataviz/roles.py - About 35 mins to fix

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

        def conversation_download_data(conversation, *, which, formats=None, cluster=None, **url_kwargs):
            if ":" not in which:
                which = f"boards:dataviz-{which}"
                if cluster is not None:
                    which += "-cluster"
        Severity: Minor
        Found in src/ej_dataviz/roles.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