Showing 82 of 91 total issues
File resources.py
has 695 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
The :mod:`~kotti.resources` module contains all the classes for Kotti's
persistence layer, which is based on SQLAlchemy.
Inheritance Diagram
File filedepot.py
has 538 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import mimetypes
import uuid
from cgi import FieldStorage
from datetime import datetime
File users.py
has 528 lines of code (exceeds 250 allowed). Consider refactoring. Open
""" User management screens """
import re
from urllib.parse import urlencode
import colander
File actions.py
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Action views
"""
from pyramid.exceptions import Forbidden
from pyramid.httpexceptions import HTTPFound
Function change_state
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def change_state(self):
""" Change state view. Renders either a view to handle workflow changes
for multiple nodes or handle the selected workflow changes and get
back to the referrer of the 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
File security.py
has 427 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections.abc import MutableMapping
from contextlib import contextmanager
from datetime import datetime
from typing import Dict
from typing import Iterable
File util.py
has 413 lines of code (exceeds 250 allowed). Consider refactoring. Open
import hashlib
from collections import defaultdict
from datetime import datetime
from urllib.parse import urlencode
File events.py
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""This module includes a simple events system that allows users to
subscribe to specific events, and more particularly to *object events*
of specific object types.
See also: :ref:`events`.
Function UploadController
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UploadController($scope, $http, $log) {
$log.info("Initializing UploadController...");
$scope.files = [];
Function roles_form_handler
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def roles_form_handler(context, request, available_role_names, groups_lister):
changed = []
if "apply" in request.POST:
p_to_r = {}
- 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
File login.py
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Login / logout and forbidden views and forms.
"""
from datetime import datetime
TemplateAPI
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class TemplateAPI:
"""This implements the ``api`` object that's passed to all templates.
Use dict-access as a shortcut to retrieve template macros from templates.
"""
Function paste_nodes
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def paste_nodes(self):
""" Paste nodes view. Paste formerly copied or cutted nodes into the
current context. Note that a cutted node can not be pasted into itself.
:result: Redirect response to the referrer of the 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
File util.py
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Inheritance Diagram
-------------------
.. inheritance-diagram:: kotti.util
Function search_principals
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def search_principals(request, context=None, ignore=None, extra=()):
flash = request.session.flash
principals = get_principals()
if ignore is 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"
Further reading
Function get_paste_items
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def get_paste_items(context, request):
from kotti.resources import Node
items = []
info = request.session.get("kotti.paste")
- 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 list_groups_ext
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def list_groups_ext(name, context=None, _seen=None, _inherited=None):
name = name
groups = set()
recursing = _inherited is not None
_inherited = _inherited or set()
- 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__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __call__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, request):
"""The first part of this function is copied without changes from
:meth:`pyramid.traversal.ResourceTreeTraverser.__call__`.
:param request: Current 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 set_max_age
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def set_max_age(response, delta, cache_ctrl=None):
"""Sets max-age and expires headers based on the timedelta `delta`.
If `cache_ctrl` is not None, I'll add items found therein to the
Cache-Control header.
- 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"