Showing 44 of 46 total issues
Function get_keys
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def get_keys(
hive: int,
key: str,
arch: int = 0,
recursion_level: int = 1,
- Read upRead up
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 query_wmi
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def query_wmi(
query_str: str,
namespace: str = "cimv2",
name: str = "noname",
depth: int = 1,
- Read upRead up
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_office_version
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def get_office_version():
# type: () -> Tuple[str, Optional[str]]
"""
It's plain horrible to get the office version installed
Let's use some tricks, ie detect current Word used
- Read upRead up
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_values
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def get_values(
hive: int,
key: str,
names: List[str],
arch: int = 0,
- Read upRead up
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 wmi_object_2_list_of_dict
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def wmi_object_2_list_of_dict(
wmi_objects, depth: int = 1, root: bool = True
) -> Union[dict, list]:
"""
Return a WMI object as a list of dicts, accepts multiple depth
- Read upRead up
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_windows_updates
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def get_windows_updates(
filter_duplicates: bool = True, include_all_states: bool = False
):
"""
Let's get windows updates from multiple sources
- Read upRead up
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_installed_antivirus_software
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def get_installed_antivirus_software() -> List[dict]:
"""
Not happy with it either. But yet here we are... Thanks Microsoft for not having SecurityCenter2 on WinServers
So we need to detect used AV engines by checking what is installed and do "best guesses"
This test does not detect Windows defender since it's not an installed product
- Read upRead up
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_windows_updates_com
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get_windows_updates_com(
update_path: str = "Microsoft.Update.Session",
filter_duplicates: bool = False,
include_all_states: bool = False,
):
- Read upRead up
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_windows_updates_reg
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def get_windows_updates_reg(
reg_key: str = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages",
filter_duplicates: bool = True,
include_all_states: bool = False,
):
- Read upRead up
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 a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, powershell_interpreter=None):
self.powershell_interpreter = powershell_interpreter
if powershell_interpreter is not None and os.path.isfile(
powershell_interpreter
- Read upRead up
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 sign
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def sign(self, executable, bitness: Union[None, int, str] = None):
if not bitness:
possible_bitness = is_64bit_executable(executable)
if possible_bitness is not None:
bitness = 64 if possible_bitness else 32
- Read upRead up
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 a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def set_acls(
path: str,
user_list: Union[List[str], List[object]] = None,
group_list: Union[List[str], List[object]] = None,
owner: Union[str, object] = None,
- Read upRead up
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
File __init__.py
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of windows_tools module
Function _get_logical_disks_win32api
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _get_logical_disks_win32api(
include_fs: list = None, exclude_unknown_fs: bool = False
):
"""
include_fs: list of which filesystems to include, example ['NTFS', 'ReFS']
- Read upRead up
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_installed_office_version
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _get_installed_office_version():
# type: () -> Optional[str, bool]
"""
Try do determine which is the highest current version of Office installed
"""
- Read upRead up
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_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_value(
hive: int,
key: str,
value: Optional[str],
arch: int = 0,
- Read upRead up
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 decode_key
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def decode_key(rpk: str) -> str:
"""
Decodes a product key from registry (worked with XP, fails with newer Windows versions)
This function is derived from https://gist.github.com/Spaceghost/877110
- Read upRead up
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_windows_product_channel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_windows_product_channel() -> Optional[str]:
"""
Tries to get Windows license type (OEM/Retail/Volume)
So basically there's no good way to get that info, but the description field in SoftwareLicenseingProduct
- Read upRead up
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 query_wmi
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def query_wmi(
Function _get_logical_disks_psutil
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_logical_disks_psutil(
include_fs: list = None, exclude_unknown_fs: bool = False
):
"""
include_fs: list of which filesystems to include, example ['NTFS', 'ReFS']
- Read upRead up
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"