psyinfra/onyo

View on GitHub

Showing 56 of 56 total issues

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

    def __call__(self,
Severity: Minor
Found in onyo/argparse_helpers.py - About 35 mins to fix

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

        def __init__(self,
    Severity: Minor
    Found in onyo/argparse_helpers.py - About 35 mins to fix

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

          def mk_inventory_dirs(self,
                                dirs: Iterable[Path] | Path) -> list[Path]:
              r"""Create inventory directories `dirs`.
      
              Creates `dirs` including anchor files.
      Severity: Minor
      Found in onyo/lib/onyo.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

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

      def fsck(repo: OnyoRepo,
               tests: list[str] | None = None) -> None:
          r"""Run a suite of integrity checks on an Onyo repository and its contents.
      
          By default, the following tests are performed:
      Severity: Minor
      Found in onyo/lib/commands.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

      Avoid too many return statements within this function.
      Open

          return contains_all_comments(b_comment, a_comment) and contains_all_comments(a_comment, b_comment)
      Severity: Major
      Found in onyo/lib/utils.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return True
        Severity: Major
        Found in onyo/lib/utils.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return False
          Severity: Major
          Found in onyo/lib/utils.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return asset_value == self.value or self._re_match(str(asset_value), self.value)
            Severity: Major
            Found in onyo/lib/filters.py - About 30 mins to fix

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

                  def check_ignore(self, ignore: Path, paths: list[Path]) -> list[Path]:
                      r"""Get the `paths` that are matched by patterns defined in `ignore`.
              
                      This is utilizing ``git-check-ignore`` to evaluate `paths` against
                      a file `ignore`, that defines exclude patterns the gitignore-way.
              Severity: Minor
              Found in onyo/lib/git.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

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

                  def _get_pending_removals(self,
                                            mode: Literal['assets', 'dirs', 'all'] = 'all') -> list[Path]:
                      r"""Get paths that are removed by pending operations.
              
                      Parameters
              Severity: Minor
              Found in onyo/lib/inventory.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

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

              def get(args: argparse.Namespace) -> None:
                  r"""
                  Return values of the requested **KEY**\ s for matching assets.
              
                  If no **KEY**\ s are given, the path and all keys in the asset name are
              Severity: Minor
              Found in onyo/cli/get.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

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

              def get_asset_content(asset_file: Path) -> dict[str, bool | float | int | str | Path]:
                  r"""Get the contents of an asset as a dictionary.
              
                  If the asset file's contents are not valid YAML, an error is printed.
              
              
              Severity: Minor
              Found in onyo/lib/utils.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

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

                  def get_config(self,
                                 name: str,
                                 file_: Path | None = None) -> str | None:
                      r"""Get the value for a configuration option specified by `name`.
              
              
              Severity: Minor
              Found in onyo/lib/git.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

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

                  def _keys(self) -> Generator[str, None, None]:
                      """Recursively yield all keys from nested dicts in dot notation.
              
                      Note, that this forces the returned keys to be strings no matter their original type.
                      """
              Severity: Minor
              Found in onyo/lib/utils.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

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

                  def get_template(self,
                                   path: Path | str | None = None) -> dict:
                      r"""Select a template file and return an asset dict from it.
                       from the directory `.onyo/templates/`
              
              
              Severity: Minor
              Found in onyo/lib/onyo.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

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

                  def get_asset_content(self,
                                        path: Path) -> dict:
                      r"""Get a dictionary representing `path`'s content.
              
                      Parameters
              Severity: Minor
              Found in onyo/lib/onyo.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

              Severity
              Category
              Status
              Source
              Language