Showing 579 of 869 total issues
Function populate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def populate(self):
# always use draft if we have a page
self.page = get_page_draft(self.request.current_page)
if not self.page:
- 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_context
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_context(self, context, template, i18n_mode):
if template in MARKERS:
_tmp = template
if i18n_mode not in MARKERS:
template = i18n_mode
- 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_item
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _add_item(self, item, position=None):
item.toolbar = self
if item.right:
if position and position < 0:
- 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 _verify_apphook
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _verify_apphook(apphook, namespace):
"""
Verifies the apphook given is valid and returns the normalized form (name)
"""
apphook_pool.discover_apps()
- 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 _moveToDropdown
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_moveToDropdown(numberOfItems, part) {
if (numberOfItems <= 0) {
return;
}
Function unselect
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
unselect: function (selected) {
var val = this.getVal(),
data,
index;
selected = selected.closest(".select2-search-choice");
Function resolveContainerWidth
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolveContainerWidth() {
var style, attrs, matches, i, l, attr;
if (this.opts.width === "off") {
return null;
Function _setupQuickSearch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupQuickSearch: function _setupQuickSearch(plugins) {
var that = this;
var FILTER_DEBOUNCE_TIMER = 100;
var FILTER_PICK_DEBOUNCE_TIMER = 110;
Function _moveOutOfDropdown
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_moveOutOfDropdown(numberOfItems, part) {
if (numberOfItems <= 0) {
return;
}
Function postprocessResults
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
postprocessResults: function (data, initial, noHighlightUpdate) {
var val = this.getVal(),
choices = this.results.find(".select2-result"),
compound = this.results.find(".select2-result-with-children"),
self = this;
Function prepareOpts
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
prepareOpts: function () {
var opts = this.parent.prepareOpts.apply(this, arguments),
self=this;
if (opts.element.get(0).tagName.toLowerCase() === "select") {
Function addPlugin
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
addPlugin: function(type, name, parent) {
var params = {
placeholder_id: this.options.placeholder_id,
plugin_type: type,
cms_path: path,
Function query
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
opts.query = this.bind(function (query) {
var data = { results: [], more: false },
term = query.term,
children, placeholderOption, process;
Function _PointerEvent__PointerEvent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _PointerEvent__PointerEvent(inType, inDict) {
inDict = inDict || Object.create(null);
var e = document.createEvent('Event');
e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);
Function _setupKeyboardTraversing
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupKeyboardTraversing: function _setupKeyboardTraversing() {
var dropdown = $('.cms-modal-markup .cms-plugin-picker');
const keyDownTraverseEvent = this._getNamepacedEvent(Plugin.keyDown, 'traverse');
if (!dropdown.length) {
Function _setup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setup() {
var that = this;
// cancel if there is no structure / content switcher
if (!this.ui.toolbarModeSwitcher.length) {
Function setupNamespaces
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
appHooks.setupNamespaces = function () {
var opt = $(this).find('option:selected');
if ($(appCfgs).length > 0 && apphooks_configuration[opt.val()]) {
appCfgs.html('');
Consider simplifying this complex logical expression. Open
if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) {
event.stopImmediatePropagation();
}
Function _get_data_context
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_data_context(self, context, instance, attribute, edit_fields,
Function _get_editable_context
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_editable_context(self, context, instance, language, edit_fields,