pages/plugins/pofiles/utils.py
Function export_po_files
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
Open
def export_po_files(path='poexport', stdout=None):
"""
Export all the content from the published pages into
po files. The files will be automatically updated
with the new content if you run the command again.
- 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 import_po_files
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
def import_po_files(path='poexport', stdout=None):
"""
Import all the content updates from the po files into
the pages.
"""
- 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
Open
if page not in pages_to_invalidate:
pages_to_invalidate.append(page)
Avoid deeply nested control flow statements. Open
Open
if target_content:
tc_id = str(target_content.id)
else:
tc_id = ""
entry = polib.POEntry(msgid=source_content.body,
Avoid deeply nested control flow statements. Open
Open
if entry not in po:
po.append(entry)
po.save(po_path)