kedder/openvario-shell

View on GitHub

Showing 49 of 49 total issues

File api.py has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Interfaces for Openvario extensions"""

import asyncio
import enum
from abc import abstractmethod
Severity: Minor
Found in src/ovshell/api.py - About 5 hrs to fix

    File setupapp.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import asyncio
    from typing import Callable
    
    import urwid
    
    
    Severity: Minor
    Found in src/ovshell_core/setupapp.py - About 3 hrs to fix

      File backupapp.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import asyncio
      import os
      from abc import abstractmethod
      from pathlib import Path
      from typing import Optional
      Severity: Minor
      Found in src/ovshell_fileman/backupapp.py - About 3 hrs to fix

        File testing.py has 295 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import asyncio
        import os
        from contextlib import contextmanager
        from dataclasses import dataclass
        from typing import Any, Callable, Coroutine, Generator, Iterable, Iterator, Optional
        Severity: Minor
        Found in src/ovshell/testing.py - About 3 hrs to fix

          File screen.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import asyncio
          import functools
          from contextlib import contextmanager
          from dataclasses import dataclass
          from typing import Callable, Coroutine, Iterator, Optional, Sequence
          Severity: Minor
          Found in src/ovshell/screen.py - About 2 hrs to fix

            Function unpack_variants has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            def unpack_variants(var: Union[Variant, Any], tp: Optional[str] = None) -> Any:
                if not isinstance(var, Variant):
                    if tp is None:
                        return var
                    var = Variant(tp, var)
            Severity: Minor
            Found in src/ovshell_connman/agentiface.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 debounce_esc has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            def debounce_esc(keys, raw):
                # For some weird reason, SteFly remote stick sends two "Escape" key presses
                # when user presses X button once. Whatever reason might be, this is a
                # permanent deision and we have to deal with that. We still want to handle
                # single escape keypresses though, to support input devices that behave
            Severity: Minor
            Found in src/ovshell/main.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 _notify_service_changed has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def _notify_service_changed(
                    self, changed: list[tuple[str, dict[str, Variant]]], removed: list[str]
                ) -> None:
                    totrack = []
                    # Update props
            Severity: Minor
            Found in src/ovshell_connman/manager.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Minor
            Found in src/ovshell_core/setupapp.py - About 35 mins to fix

              Avoid too many return statements within this function.
              Open

                      return [unpack_variants(v, childtype) for v in var.value]
              Severity: Major
              Found in src/ovshell_connman/agentiface.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return var.value
                Severity: Major
                Found in src/ovshell_connman/agentiface.py - About 30 mins to fix

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

                      def _set_option(self, key: str, value: str) -> None:
                          modified_line = f'{key}="{value}"\n'
                          for n, line in enumerate(self.lines):
                              if "=" not in line:
                                  continue
                  Severity: Minor
                  Found in src/ovshell_xcsoar/ext.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 _publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _publish(self, dev: api.Device, msg: bytes) -> None:
                          if not self._queues:
                              return
                  
                          try:
                  Severity: Minor
                  Found in src/ovshell/device.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 _handle_service_clicked has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _handle_service_clicked(self, svc: ConnmanService, w: urwid.Widget) -> None:
                          # Find what actions we can perform with this service
                          actions = []
                          can_connect = False
                          if svc.state in (ConnmanServiceState.IDLE, ConnmanServiceState.FAILURE):
                  Severity: Minor
                  Found in src/ovshell_connman/app.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 _handle_svcs_changed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _handle_svcs_changed(self) -> None:
                          svcs = self._manager.list_services()
                          if not svcs:
                              self._no_connection()
                              return
                  Severity: Minor
                  Found in src/ovshell_connman/indicator.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

                  Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
                  Open

                          assert v is not None
                  Severity: Info
                  Found in src/ovshell/testing.py by bandit

                  subprocess call - check for execution of untrusted input.
                  Open

                          subprocess.run(["systemctl", "poweroff"])
                  Severity: Info
                  Found in src/ovshell/ovos.py by bandit

                  Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
                  Open

                          assert fname.startswith("/"), "Absolute path is required"
                  Severity: Info
                  Found in src/ovshell/ovos.py by bandit

                  Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
                  Open

                          assert isinstance(out, list)
                  Severity: Info
                  Found in src/ovshell/screen.py by bandit

                  Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
                  Open

                          assert proc.stdout is not None
                  Severity: Info
                  Found in src/ovshell/ovos.py by bandit
                  Severity
                  Category
                  Status
                  Source
                  Language