netinvent/windows_tools

View on GitHub

Showing 44 of 46 total issues

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

def get_installed_software() -> list:
    """
    Returns installed windows software found in registry

    :return: (list) List of dictionnaries containing name, version and publisher of software
Severity: Minor
Found in windows_tools/installed_software/__init__.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 delete_sub_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def delete_sub_key(root_key: int, current_key: str, arch: int = 0) -> None:
    """

    :param root_key: winreg registry root key constant
    :param current_key:
Severity: Minor
Found in windows_tools/registry/__init__.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 set_acls has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def set_acls(
Severity: Major
Found in windows_tools/file_utils/__init__.py - About 50 mins to fix

    Function get_keys has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def get_keys(
    Severity: Major
    Found in windows_tools/registry/__init__.py - About 50 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if ver in click_and_run_ident:
                                  return ver
                      return "2016/2019/O365"
      Severity: Major
      Found in windows_tools/office/__init__.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if re.search(virt_product, product_id[key][sub_key], re.IGNORECASE):
                                # Thanks Microsoft, fuzzy detection
                                if virt_product == "VRTUAL":
                                    virt_product = "Hyper-V"
                                return True, virt_product
        Severity: Major
        Found in windows_tools/virtualization/__init__.py - About 45 mins to fix

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

          def get_values(
          Severity: Minor
          Found in windows_tools/registry/__init__.py - About 45 mins to fix

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

            def get_paths_recursive_and_fix_permissions(
            Severity: Minor
            Found in windows_tools/file_utils/__init__.py - About 35 mins to fix

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

              def get_value(
              Severity: Minor
              Found in windows_tools/registry/__init__.py - About 35 mins to fix

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

                    def _get_keys(
                Severity: Minor
                Found in windows_tools/registry/__init__.py - About 35 mins to fix

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

                  def get_local_group_members(
                      server: str = "\\\\" + win32api.GetComputerName(), group_sid: str = None
                  ) -> list:
                      """
                      Returns members of local given local group SID
                  Severity: Minor
                  Found in windows_tools/users/__init__.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 get_paths_recursive_and_fix_permissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_paths_recursive_and_fix_permissions(
                      path: str,
                      owner: object = None,
                      permissions: int = None,
                      user_list: Union[List[str], List[object]] = None,
                  Severity: Minor
                  Found in windows_tools/file_utils/__init__.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 get_logical_disks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def get_logical_disks(
                      include_fs: list = None,
                      exclude_unknown_fs: bool = False,
                      include_network_drives: bool = True,
                  ):
                  Severity: Minor
                  Found in windows_tools/logical_disks/__init__.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 is_rds_server has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def is_rds_server():
                      """
                      Check if current machine has terminal services in RDS or single user mode
                  
                      We'll first check Win32_OperatingSystem()[0].OSProductSuite
                  Severity: Minor
                  Found in windows_tools/server/__init__.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 None
                  Severity: Major
                  Found in windows_tools/wmi_queries/__init__.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return "OEM_COA_SLP"
                    Severity: Major
                    Found in windows_tools/product_key/__init__.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return None
                      Severity: Major
                      Found in windows_tools/server/__init__.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return "UNKNOWN"
                        Severity: Major
                        Found in windows_tools/product_key/__init__.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return "VOLUME"
                          Severity: Major
                          Found in windows_tools/product_key/__init__.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return "OEM"
                            Severity: Major
                            Found in windows_tools/product_key/__init__.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language