Showing 14 of 14 total issues
Function parse_command_args
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
def parse_command_args(arguments: str or None, expected_args: List[Argument]) -> dict:
"""
Parses the given argument text
:param arguments: the argument text
:param expected_args: a list of expected arguments
- 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 command
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def command(name: str or [str], description: str = None,
arguments: [Argument] = None,
hidden: bool or callable = None,
permissions: Permission = None,
command_target: bytes = CommandTarget.UNSPECIFIED | CommandTarget.SELF,
- 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 split_into_tokens
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def split_into_tokens(text: str) -> List[str]:
"""
This is a simple shell-style tokenizer for command arguments.
The goal was to emulate posix behaviour, while maintaining quotation characters,
to be able to differentiate quoted and non-quoted tokens even after tokenization.
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, name: str or [str], description: str, example: str, type: type = str, converter: callable = None,
flag: bool = False, optional: bool = False, default: any = None, validator: callable = None):
"""
Creates a command argument object
:param name: the name (or names) of the argument
- 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 starts_with_naming_prefix
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def starts_with_naming_prefix(arg: str, abbreviated: bool or None = None) -> bool:
"""
Checks if the given string starts
:param arg: the arg to check
:param abbreviated: whether to look for a prefix used for abbreviated argument keys
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name: str or [str], description: str, example: str, type: type = str, converter: callable = None,
Function command
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def command(name: str or [str], description: str = None,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name: str or [str], description: str, allowed_values: [any], type: type = str, converter: callable = None,
Function find_duplicates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_duplicates(l: list) -> []:
"""
Finds duplicate entries in the given list
:param l: the list to check
:return: map of (value -> list of indexes)
- 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
Avoid deeply nested control flow statements. Open
for name in arg.names:
arg_name_map.pop(name)
continue
Avoid deeply nested control flow statements. Open
if len(current_token) > 0:
tokens.append(current_token)
current_token = ""
Function parse_arg_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_arg_value(self, arg: str or None) -> any:
"""
Tries to parse the given value
:param arg: the string value
:return: the parsed value
- 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
Avoid too many return
statements within this function. Open
return wrapped
Function is_quoted
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def is_quoted(text: str or any) -> bool:
"""
Checks if the given text is quoted.
Note: This method expects a stripped text!
When passing something other than a str, the result will always be 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"