File stylesheet.py
has 536 lines of code (exceeds 250 allowed). Consider refactoring. Open
##############################################################################
#
# Copyright (c) 2017 Shoobx, Inc.
# All Rights Reserved.
#
Function registerListStyle
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def registerListStyle(doc, name, rmlStyle, attributes=None, ulol=None):
"""Registers an rmlStyle as ODF styles
rmlStyles have information both for ordered and unordered lists,
ODF styles do not, so we need to register two different, but similar lists.
- 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 registerParagraphStyle
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def registerParagraphStyle(doc, name, rmlStyle):
if 'style.' in name:
name = name[6:]
odtStyle = odf.style.Style(name=name, family='paragraph')
- 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 convertLineStyle
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def convertLineStyle(attrs):
# ODT line styles discovered by trying:
# solid, dotted, dashed, fine-dashed, dash-dot, dash-dot-dot,
# double, double-thin
# there are plenty left
- 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 adjustAttributeValues
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def adjustAttributeValues(self, style, parentName):
try:
parentElem = self.parent.parent.document.getStyleByName(
str(parentName))
except AssertionError:
- 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 registerParagraphStyle
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def registerParagraphStyle(doc, name, rmlStyle):
if 'style.' in name:
name = name[6:]
odtStyle = odf.style.Style(name=name, family='paragraph')
Avoid deeply nested control flow statements. Open
if dash[0] in (1, 2):
style = 'dotted'
elif dash[0] in (3, 4):
style = 'fine-dashed'
else:
Function registerListStyle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def registerListStyle(doc, name, rmlStyle, attributes=None, ulol=None):