Showing 579 of 869 total issues
Function set_page_cache
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def set_page_cache(response):
from django.core.cache import cache
request = response._request
toolbar = get_toolbar_from_request(request)
- 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_page_path
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_page_path(self, lang):
page = getattr(self.request, 'current_page', None)
if not page:
return '/%s/' % lang if settings.USE_I18N 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 create_alias
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def create_alias(self, request):
if not request.user.is_staff:
return HttpResponseForbidden("not enough privileges")
if "plugin_id" not in request.POST and "placeholder_id" not in request.POST:
return HttpResponseBadRequest("plugin_id or placeholder_id POST parameter missing.")
- 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 prepareOpts
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareOpts: function () {
var opts = this.parent.prepareOpts.apply(this, arguments),
self=this;
// TODO validate placeholder is a string if specified
Function addSelectedChoice
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
addSelectedChoice: function (data) {
var enableChoice = !data.locked,
enabledItem = $(
"<li class='select2-search-choice'>" +
" <div></div>" +
Function isAllowed
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
isAllowed: function(placeholder, placeholderParent, originalItem) {
// cancel if action is executed
if (CMS.API.locked) {
return false;
}
Function val
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
val: function () {
var val,
triggerChange = false,
data = null,
self = this,
Consider simplifying this complex logical expression. Open
if (this.floating && horizontalDirection) {
return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
} else {
return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && isOverTopHalf));
}
Function _setSettingsMenu
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setSettingsMenu: function _setSettingsMenu(nav) {
var that = this;
this.ui.dropdown = nav.siblings('.cms-submenu-dropdown-settings');
var dropdown = this.ui.dropdown;
Function populateResults
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
populateResults: function(container, results, query) {
var populate, id=this.opts.id, liveRegion=this.liveRegion;
populate=function(results, container, depth) {
Function _initialStates
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initialStates: function _initialStates() {
var publishBtn = $('.cms-btn-publish').parent();
this._show({ duration: 0 });
Function _events
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
_events() {
var that = this;
// modal behaviours
this.ui.minimizeButton
Function _calculateNewPosition
has 40 lines of code (exceeds 25 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();
Function setupUI
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_setupUI: function setupUI(container) {
var wrapper = $(`.${container}`);
var contents;
// have to check for cms-plugin, there can be a case when there are multiple
- 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 getDistPath
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var getDistPath = function(scriptFileName) {
var fileNameReplaceRegExp = new RegExp(scriptFileName + '.*$', 'gi');
if (document.currentScript) {
return document.currentScript.src.replace(fileNameReplaceRegExp, '');
- 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_formset
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_formset(self, request, obj=None, **kwargs):
"""
Some fields may be excluded here. User can change only
permissions which are available for them. E.g. if user does not have
can_publish flag, they can't change assign can_publish permissions.
- 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 keydown
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return
var $this = $(this)
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def render_tag(self, context, page, language):
page_pending_publication = page.get_publisher_state(language) == PUBLISHER_STATE_PENDING
if page.is_published(language) and not page_pending_publication:
if page.is_dirty(language):
- 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 cms_perms
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def cms_perms(func):
def inner(request, *args, **kwargs):
page = request.current_page
if page:
if page.login_required and not request.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 check_sekizai
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_sekizai(output):
with output.section("Sekizai") as section:
sekizai_installed = is_installed('sekizai')
if sekizai_installed:
- 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"