Function process_input
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Wontfix
def process_input(config, data_fd, forward_fd=None, max_wait=None):
'''Processes input by reading from data_fd, highlighting it using config,
then printing it to sys.stdout. If forward_fd is not None, any data it has
will be written (forwarded) into data_fd.
- 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 load_config
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Wontfix
def load_config(config, data, rgb=False, pcre=False):
'''Reads configuration from a YAML-based string, formatted like so:
palette:
red: "#ff0000"
blue: "#0000ff"
- 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 main
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Wontfix
def main(args=None, max_wait=None, write_default=True):
'''Command line utility entry point.
Args:
args (list): A list of program arguments. Defaults to sys.argv.
- 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 signal_chromaterm_instances
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Invalid
def signal_chromaterm_instances(sig):
'''Sends `sig` signal to all other ChromaTerm CLI instances.
Returns:
The number of processes reloaded.
- 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 parse_rule
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Wontfix
def parse_rule(data, palette=None, rgb=False, pcre=False):
'''Returns an instance of chromaterm.Rule if parsed correctly. Otherwise, a
string with the error message is returned.
Args:
- 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_default_config_location
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Invalid
def get_default_config_location():
'''Returns the first location in `CONFIG_LOCATIONS` that points to a file,
defaulting to the first item in the list.'''
resolve = lambda x: os.path.expanduser(os.path.expandvars(x))
- 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"