Showing 3 of 20 total issues
Function get_inserts
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Confirmed
Confirmed
def get_inserts(self, data, inserts):
'''Returns a list containing the inserts for the color codes relative to
data. An insert is a list containing a position (index relative to data),
the code to be inserted, a boolean indicating if its a reset code or not,
and The color type which corresponds to COLOR_TYPES or `None` if it's a
- 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 highlight
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Confirmed
Confirmed
def highlight(self, data):
'''Returns a highlighted bytes of `data`. The matches from the rules
are gathered prior to inserting any color codes, making it so the rules
can match without the color codes interfering.
- 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. Confirmed
Confirmed
if insert[3] is None:
end_insert[1:4] = insert[1:4]