bitranox/lib_registry

View on GitHub

Showing 9 of 9 total issues

File lib_registry.py has 1008 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# STDLIB
"""

https://github.com/adamkerz/winreglib/blob/master/winreglib.py

Severity: Major
Found in lib_registry/lib_registry.py - About 2 days to fix

    Registry has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Registry(object):
        def __init__(self, key: Union[None, str, int] = None, computer_name: Optional[str] = None):
            """
            The Registry Class, to create the registry object.
            If a key is passed, a connection to the hive is established.
    Severity: Minor
    Found in lib_registry/lib_registry.py - About 2 hrs to fix

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

          def delete_key(self, key: Union[str, int], sub_key: str = '', missing_ok: bool = False, delete_subkeys: bool = False) -> None:
              """
              deletes the specified key, this method can delete keys with subkeys.
              If the method succeeds, the entire key, including all of its values, is removed.
      
      
      Severity: Minor
      Found in lib_registry/lib_registry.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 _reg_connect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def _reg_connect(self, key: Union[str, int], computer_name: Optional[str] = None) -> winreg.HKEYType:
              """
              Establishes a connection to a predefined registry handle on another computer, and returns a handle object.
              The user should not need to use this method - hives are opened, reused and closed automatically
      
      
      Severity: Minor
      Found in lib_registry/lib_registry.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 set_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_value(self, key: Union[str, int], value_name: Optional[str], value: RegData, value_type: Optional[int] = None) -> None:
              """
              Stores data in the value field of an open registry key.
              key is a key by string, or one of the predefined HKEY_* constants.
      
      
      Severity: Minor
      Found in lib_registry/lib_registry.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 subkeys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def subkeys(self, key: Union[str, int], sub_key: str = '') -> Iterator[str]:
              """
              Iterates through subkeys of an open registry key, returning a string.
              key by string, or one of the predefined HKEY_* constants.
              The function retrieves the name of one subkey each time it is called.
      Severity: Minor
      Found in lib_registry/lib_registry.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 resolve_key has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def resolve_key(key: Union[str, int], sub_key: str = '') -> Tuple[int, str]:
          """
          Returns hive_key and sub_key relative to the hive_key
      
          >>> # DONE #3
      Severity: Minor
      Found in lib_registry/lib_registry.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 values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def values(self, key: Union[str, int], sub_key: str = '') -> Iterator[Tuple[str, RegData, int]]:
              """
              Iterates through values of a registry key, returning a tuple.
              key by string, or one of the predefined HKEY_* constants.
              The function retrieves the name of one subkey each time it is called.
      Severity: Minor
      Found in lib_registry/lib_registry.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 create_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_key(self, key: Union[str, int], sub_key: str = '', exist_ok: bool = True, parents: bool = False) -> winreg.HKEYType:
              """
              Creates a Key, and returns a Handle to the new key
      
      
      
      Severity: Minor
      Found in lib_registry/lib_registry.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