psyinfra/onyo

View on GitHub

Showing 56 of 56 total issues

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

def repo(tmp_path: Path, monkeypatch, request) -> Generator[OnyoRepo, None, None]:
    r"""
    This fixture:
    - creates a new repository in a temporary directory
    - `cd`s into the repository
Severity: Minor
Found in onyo/conftest.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 __setitem__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __setitem__(self, key, item):
        if isinstance(key, str):
            parts = key.split('.')
            effective_dict = self.data
            if len(parts) > 1:
Severity: Minor
Found in onyo/lib/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 __delitem__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __delitem__(self, key):
        if isinstance(key, str):
            parts = key.split('.')
            effective_dict = self.data
            if len(parts) > 1:
Severity: Minor
Found in onyo/lib/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 raise_on_inventory_state has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def raise_on_inventory_state(func: Callable[P, T]) -> Callable[P, T]:
    r"""Raise if the ``Inventory`` state is unsafe to run an onyo command.

    Decorator for Onyo commands. Requires an ``Inventory`` to be among the
    arguments of the decorated function.
Severity: Minor
Found in onyo/lib/commands.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 asset_paths_available has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def asset_paths_available(self, assets: dict | list[dict]) -> None:
        r"""Test whether path used by `assets` are available in the inventory.

        Availability not only requires the path to not yet exist, but also the filename to be unique.

Severity: Minor
Found in onyo/lib/inventory.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 onyo_edit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def onyo_edit(inventory: Inventory,
              paths: list[Path],
              message: str | None,
              auto_message: bool | None = None) -> None:
    r"""Edit the content of assets.
Severity: Minor
Found in onyo/lib/commands.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 onyo_new has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def onyo_new(inventory: Inventory,
Severity: Major
Found in onyo/lib/commands.py - About 1 hr to fix

    Function onyo_config has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def onyo_config(inventory: Inventory,
                    config_args: list[str]) -> None:
        r"""Set, query, and unset Onyo repository configuration options.
    
        Arguments are passed through directly to ``git config``. Those that change
    Severity: Minor
    Found in onyo/lib/commands.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 onyo_get has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def onyo_get(inventory: Inventory,
    Severity: Major
    Found in onyo/lib/commands.py - About 1 hr to fix

      Function onyorepo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def onyorepo(gitrepo, request, monkeypatch) -> Generator[AnnotatedOnyoRepo, None, None]:
          from onyo.lib.utils import deduplicate
          onyo = AnnotatedOnyoRepo(gitrepo.root, init=True)
          onyo.test_annotation = {'assets': [],
                                  'dirs': [],
      Severity: Minor
      Found in onyo/conftest.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 rename_directory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def rename_directory(self, src: Path, dst: str | Path) -> list[InventoryOperation]:
              if not self.repo.is_inventory_dir(src) and src not in self._get_pending_dirs():
                  raise ValueError(f"Not an inventory directory: {src}")
              if self.repo.is_asset_dir(src):
                  raise NotADirError("Renaming an asset directory must be done via `rename_asset`.")
      Severity: Minor
      Found in onyo/lib/inventory.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 get_asset_paths has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_asset_paths(self,
                              include: Iterable[Path] | None = None,
                              exclude: Iterable[Path] | Path | None = None,
                              depth: int = 0
                              ) -> List[Path]:
      Severity: Minor
      Found in onyo/lib/onyo.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

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

      def onyo_cat(inventory: Inventory,
                   paths: list[Path]) -> None:
          r"""Print the contents of assets.
      
          The same asset can be given multiple times.
      Severity: Minor
      Found in onyo/lib/commands.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

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

          def operations_summary(self) -> str:
              summary = "--- Inventory Operations ---\n"
              operations_record = dict()
      
              for operation in self.operations:
      Severity: Minor
      Found in onyo/lib/inventory.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

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

      def onyo_set(inventory: Inventory,
      Severity: Minor
      Found in onyo/lib/commands.py - About 35 mins to fix

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

            def get_assets_by_query(self,
        Severity: Minor
        Found in onyo/lib/inventory.py - About 35 mins to fix

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

          def onyo_rm(inventory: Inventory,
          Severity: Minor
          Found in onyo/lib/commands.py - About 35 mins to fix

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

                def __call__(self, parser, namespace, values, option_string=None):
            Severity: Minor
            Found in onyo/argparse_helpers.py - About 35 mins to fix

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

              def onyo_mv(inventory: Inventory,
              Severity: Minor
              Found in onyo/lib/commands.py - About 35 mins to fix

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

                def onyo_unset(inventory: Inventory,
                Severity: Minor
                Found in onyo/lib/commands.py - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language