Showing 579 of 869 total issues
Function render_placeholder
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_placeholder(self, placeholder, context, language=None, page=None,
Function add_sideframe_item
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_sideframe_item(self, name, url, active=False, disabled=False,
Function add_button
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_button(self, name, url, active=False, disabled=False, extra_classes=None, extra_wrapper_classes=None,
Function add_modal_item
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_modal_item(self, name, url, active=False, disabled=False,
Function create_option
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
Function _checkIfPasteAllowed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_checkIfPasteAllowed: function _checkIfPasteAllowed() {
var pasteButton = this.ui.dropdown.find('[data-rel=paste]');
var pasteItem = pasteButton.parent();
if (!clipboardDraggable.length) {
- 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 findIndex
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.findIndex = function (predicate) {
if (this === null) {
throw new TypeError('Array.prototype.findIndex called on null or undefined');
}
if (typeof predicate !== 'function') {
- 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 edit_field
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def edit_field(self, request, object_id, language):
obj = self._get_object_for_single_field(object_id, language)
opts = obj.__class__._meta
saved_successfully = False
cancel_clicked = request.POST.get("_cancel", False)
- 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 preview_page
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def preview_page(self, request, object_id, language):
"""
Redirecting preview function based on draft_id
"""
page = self.get_object(request, object_id=object_id)
- 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 _calculateNewPosition
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_calculateNewPosition(opts) {
// lets set the modal width and height to the size of the browser
var widthOffset = 300; // adds margin left and right
var heightOffset = 300; // adds margin top and bottom;
var screenWidth = this.ui.window.width();
- 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_empty_context
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _get_empty_context(self, context, instance, edit_fields, language,
view_url, view_method, editmode=True):
"""
Inject in a copy of the context the data requested to trigger the edit.
- 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 render_tag
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def render_tag(self, context, code, extra_bits, nodelist=None):
request = context.get('request')
if not code or not request:
# an empty string was passed in or the variable is not available in the context
- 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 delete_view
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def delete_view(self, request, object_id, extra_context=None):
# This is an unfortunate copy/paste from django's delete view.
# The reason is to add the descendant pages to the deleted objects list.
opts = self.model._meta
app_label = opts.app_label
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
super().clean()
if not self.user and not self.group:
raise ValidationError(_('Please select user or group.'))
- 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 user_can_view_page
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def user_can_view_page(user, page, site=None):
if site is None:
site = get_current_site()
if user.is_superuser:
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
from cms.utils.plugins import has_reached_plugin_limit
data = self.cleaned_data
- 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_title_extensions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _copy_title_extensions(self, source_page, target_page, language, clone=False):
source_title = source_page.title_set.get(language=language)
if target_page:
target_title = target_page.title_set.get(language=language)
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 auth_permission_required
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def auth_permission_required(action):
def decorator(func):
@wraps(func, assigned=available_attrs(func))
def wrapper(user, *args, **kwargs):
if not user.is_authenticated:
- 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 _build_nodes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _build_nodes(self):
"""
This is slow. Caching must be used.
One menu is built per language and per site.
- 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 add_draft_live
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_draft_live(self):
if self.page:
if self.toolbar.edit_mode_active and not self.title:
self.add_page_settings_button()
- 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"