Showing 24 of 73 total issues
Function items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def items(self):
items = []
self.url_cache.clear()
for lang in get_language_list():
self.url_cache[lang] = {}
- 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 _clean_html
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _clean_html(self, content):
body = BytesIO(content)
document = etree.iterparse(body, html=True)
for _a, element in document:
if not (element.text and element.text.strip()) and len(element) == 0 and element.tag == "p":
- 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_months
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_months(self, queryset=None, current_site=True):
"""
Get months with aggregate count (how much posts is in the month).
Results are ordered by date.
"""
- 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 populate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def populate(self):
if (
not self.is_current_app and not get_setting("ENABLE_THROUGH_TOOLBAR_MENU")
) or not self.request.user.has_perm("djangocms_blog.add_post"):
return # pragma: no cover
- 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"