ejplatform/ej-server

View on GitHub
etc/tasklib/base.py

Summary

Maintainability
B
4 hrs
Test Coverage

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

def watch_path(path, func, poll_time=0.5, name=None, skip_first=False):
    """
    Watch path and execute the given function everytime a file changes.
    """
    import time
Severity: Minor
Found in etc/tasklib/base.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 exec_watch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def exec_watch(path, func, name, watch=False, background=False, poll_time=0.5):
    path = str(path)
    if watch and background:
        go = lambda: watch_path(path, func, name=name, poll_time=poll_time)
        return exec_watch(path, go, name, background=True)
Severity: Minor
Found in etc/tasklib/base.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

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

def exec_watch(path, func, name, watch=False, background=False, poll_time=0.5):
Severity: Minor
Found in etc/tasklib/base.py - About 45 mins to fix

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

    def manage(ctx, cmd, *args, env=None, **kwargs):
    Severity: Minor
    Found in etc/tasklib/base.py - About 35 mins to fix

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

      def watch_path(path, func, poll_time=0.5, name=None, skip_first=False):
      Severity: Minor
      Found in etc/tasklib/base.py - About 35 mins to fix

        Function set_theme has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def set_theme(theme):
            if theme and "/" in theme:
                theme = theme.rstrip("/")
                root = f"{theme}/"
                theme = os.path.basename(theme)
        Severity: Minor
        Found in etc/tasklib/base.py - About 35 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