Showing 579 of 869 total issues
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 init_toolbar
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def init_toolbar(self, request, request_path=None):
self.request = request
self.is_staff = self.request.user.is_staff
self.show_toolbar = self.is_staff or self.request.session.get('cms_edit', 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 recurse_patterns
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def recurse_patterns(path, pattern_list, page_id, default_args=None,
nested=False):
"""
Recurse over a list of to-be-hooked patterns for a given path prefix
"""
- 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 _handleResize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleResize() {
var remainingWidth;
var availableWidth = this._calculateAvailableWidth();
if (availableWidth > this.items.leftTotalWidth + this.items.rightTotalWidth) {
Function openAjax
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
openAjax: function(opts) {
var that = this;
// url, post, text, callback, onSuccess
var url = opts.url;
var post = opts.post || '{}';
Function reloadBrowser
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
reloadBrowser: function(url, timeout, ajax, data) {
var that = this;
// is there a parent window?
var win = this._getWindow();
var parent = win.parent ? win.parent : win;
Function _startResize
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_startResize(pointerEvent) {
// cancel if in fullscreen
if (this.maximized) {
return false;
}
Function callback
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
callback: this.bind(function (data) {
var def; // default choice
// ignore old responses
if (queryNumber != this.queryCount) {
Function update
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function(event, ui) {
// cancel if isAllowed returns false
if (!that.state) {
return false;
}
Function _checkIfPasteAllowed
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_checkIfPasteAllowed: function _checkIfPasteAllowed() {
var pasteButton = this.ui.dropdown.find('[data-rel=paste]');
var pasteItem = pasteButton.parent();
if (!clipboardDraggable.length) {
Function val
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
val: function (val, triggerChange) {
var oldData, self=this;
if (arguments.length === 0) {
return this.getVal();
Function _events
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_events() {
var that = this;
that.modal = new Modal({
minWidth: MIN_WIDTH,
Function get_copy_dialog
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_copy_dialog(self, request, page_id):
if not get_cms_setting('PERMISSION'):
return HttpResponse('')
page = self.get_page_from_id(page_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 get_title_extension_admin
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_title_extension_admin(self, language=None):
"""
Get the admin urls for the title extensions menu items, depending on whether a TitleExtension instance exists
for each Title in the current page.
A single language can be passed to only work on a single title.
- 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 move_page
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def move_page(self, target_node, position='first-child'):
"""
Called from admin interface when page is moved. Should be used on
all the places which are changing page position. Used like an interface
to django-treebeard, but after move is done page_moved signal is fired.
- 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_to_public
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def copy_to_public(self, public_object, language):
"""
This method is used to "publish" this extension as part of the a larger
operation on the target. If you intend to copy this extension to an
unrelated object, use copy() instead.
- 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_title_cache
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _get_title_cache(self, language, fallback, force_reload):
if not language:
language = get_language()
force_reload = (force_reload or language not in self.title_cache)
- 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_from_path
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_page_from_path(site, path, preview=False, draft=False, language_code=None):
"""
Resolves a url path to a single page object.
Returns None if page does not exist
- 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 modify
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
if post_cut or breadcrumb:
return nodes
final = []
for node in nodes:
- 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 __call__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, lang):
page_language = get_language_from_request(self.request)
with force_language(page_language):
try:
view = resolve(self.request.path_info)
- 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"