asphalt-framework/asphalt

View on GitHub

Showing 16 of 16 total issues

File context.py has 871 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations

__all__ = (
    "ResourceEvent",
    "ResourceConflict",
Severity: Major
Found in src/asphalt/core/context.py - About 2 days to fix

    Function dispatch_raw has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def dispatch_raw(self, event: Event) -> Awaitable[bool]:
            """
            Dispatch the given event object to all listeners.
    
            Creates a new task in which all listener callbacks are called with the given event as
    Severity: Minor
    Found in src/asphalt/core/event.py - About 2 hrs 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 run_application has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def run_application(
        component: Component | dict[str, Any],
        *,
        event_loop_policy: str | None = None,
        max_threads: int | None = None,
    Severity: Minor
    Found in src/asphalt/core/runner.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 merge_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def merge_config(
        original: dict[str, Any] | None, overrides: dict[str, Any] | None
    ) -> dict[str, Any]:
        """
        Return a copy of the ``original`` configuration dictionary, with overrides from ``overrides``
    Severity: Minor
    Found in src/asphalt/core/utils.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def run(
        configfile,
        unsafe: bool,
        loop: str | None,
        service: str | None,
    Severity: Minor
    Found in src/asphalt/core/cli.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 executor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def executor(
        func_or_executor: Executor | str | Callable[Concatenate[Context, P], T_Retval],
    ) -> (
        Callable[
            [Callable[Concatenate[Context, P], T_Retval]],
    Severity: Minor
    Found in src/asphalt/core/concurrent.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 stream_events has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def stream_events(
        signals: Sequence[Signal[T_Event]],
        filter: Callable[[T_Event], bool] | None = None,
        *,
        max_queue_size: int = 0,
    Severity: Minor
    Found in src/asphalt/core/event.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

    Avoid deeply nested control flow statements.
    Open

                            if old_lines is not None and old_lines != new_lines:
                                self.changed.dispatch(old_lines, new_lines)
    
    
    Severity: Major
    Found in examples/tutorial2/webnotifier/detector.py - About 45 mins to fix

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

      def run_application(
      Severity: Minor
      Found in src/asphalt/core/runner.py - About 45 mins to fix

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

            def __init__(
        Severity: Minor
        Found in src/asphalt/core/context.py - About 45 mins to fix

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

              def __init__(
          Severity: Minor
          Found in src/asphalt/core/context.py - About 35 mins to fix

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

                def add_resource(
            Severity: Minor
            Found in src/asphalt/core/context.py - About 35 mins to fix

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

              def run(
              Severity: Minor
              Found in src/asphalt/core/cli.py - About 35 mins to fix

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

                    def call_in_executor(
                Severity: Minor
                Found in src/asphalt/core/context.py - About 35 mins to fix

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

                      def add_resource_factory(
                  Severity: Minor
                  Found in src/asphalt/core/context.py - About 35 mins to fix

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

                            def run_complete(f: Future[int | None]) -> None:
                                # If run() raised an exception, print it with a traceback and exit with code 1
                                exc = f.exception()
                                if exc is not None:
                                    print_exception(type(exc), exc, exc.__traceback__)
                    Severity: Minor
                    Found in src/asphalt/core/component.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

                    Severity
                    Category
                    Status
                    Source
                    Language