File pluginmodel.py
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
import inspect
import json
import os
import warnings
from datetime import date
Function save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save(self, no_signals=False, *args, **kwargs):
if not self.depth:
if self.parent_id or self.parent:
self.parent.add_child(instance=self)
else:
- 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 copy_plugin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def copy_plugin(self, target_placeholder, target_language, parent_cache, no_signals=False):
Function fix_tree
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fix_tree(cls, **kwargs):
"""
Fixes the plugin tree by first calling treebeard fix_tree and the
recalculating the correct position property for each plugin.
"""
- 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 __new__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __new__(cls, name, bases, attrs):
super_new = super().__new__
# remove RenderMeta from the plugin class
attr_meta = attrs.pop('RenderMeta', None)
- 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"