Showing 82 of 91 total issues

Function workflow_callback has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def workflow_callback(context, info):
    wf = info.workflow
    to_state = info.transition.get("to_state")

    if to_state is None:
Severity: Minor
Found in kotti/workflow.py - About 1 hr to fix

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 _extract_from_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _extract_from_request(request):  # pragma: no cover
        """Extract subpath, vpath and vroot_tuple from the request.  The
        contents of this method is just a copy from the base class'
        implementation.

Severity: Minor
Found in kotti/traversal.py - About 1 hr to fix

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_delete has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def user_delete(context, request):
    principals = get_principals()

    if "name" in request.params and request.params["name"]:
        user_or_group = request.params["name"]
Severity: Minor
Found in kotti/views/users.py - About 1 hr to fix

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 __getitem__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def __getitem__(self, path: Union[str, Iterable[str]]) -> "Node":
        db_session = DBSession()
        db_session._autoflush()

        # if not hasattr(path, '__iter__'):
Severity: Minor
Found in kotti/resources.py - About 1 hr to fix

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 UploadController has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function UploadController($scope, $http, $log) {

    $log.info("Initializing UploadController...");

    $scope.files = [];
Severity: Minor
Found in kotti/static/upload.js - About 1 hr to fix

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 base_configure has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def base_configure(global_config, **settings):
    # Resolve dotted names in settings, include plug-ins and create a
    # Configurator.

    from kotti.resources import get_root
Severity: Minor
Found in kotti/__init__.py - About 1 hr to fix

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 __getattr__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __getattr__(self, key):
        for event_type in slot_events:
            if event_type.name == key:
                break
        else:
Severity: Minor
Found in kotti/views/util.py - About 1 hr to fix

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 onDrop has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        onDrop: function (table, row) {
            var rows = table.tBodies[0].rows,
                oldPosition = parseInt(row.id, 10),
                newPosition = parseInt(row.id, 10),
                i;
Severity: Minor
Found in kotti/static/contents.js - About 1 hr to fix

    Function onSubmit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                onSubmit: function (id, name) {
                    $log.info("onSubmit");
                    $scope.apply(function () {
                        var file = $scope.uploader.getFile(id);
                        $http.get(
    Severity: Minor
    Found in kotti/static/upload.js - About 1 hr to fix

      Function set_owner has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def set_owner(event):
          """Set ``owner`` of the object that triggered the event.
      
          :param event: event that triggered this handler.
          :type event: :class:`ObjectInsert`
      Severity: Minor
      Found in kotti/events.py - About 1 hr to fix

      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 migrate_storage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def migrate_storage(from_storage: str, to_storage: str) -> None:
          log = logging.getLogger(__name__)
      
          old_default = DepotManager._default_depot
          DepotManager._default_depot = to_storage
      Severity: Minor
      Found in kotti/filedepot.py - About 1 hr to fix

      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_path_for_new_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _set_path_for_new_name(target, value, oldvalue, initiator):
          """Triggered whenever the Node's 'name' attribute is set.
      
          Is called with all kind of weird edge cases, e.g. name is 'None',
          parent is 'None' etc.
      Severity: Minor
      Found in kotti/events.py - About 1 hr to fix

      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_password has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def set_password(context, request, success_msg=_("You have reset your password.")):
          """ Set password view.  Displays the set password form and handles its form
          submission.
      
          :param context: Current context
      Severity: Minor
      Found in kotti/views/login.py - About 1 hr to fix

      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 cache has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def cache(compute_key, container_factory):
          marker = object()
      
          def decorator(func):
              def replacement(*args, **kwargs):
      Severity: Minor
      Found in kotti/util.py - About 1 hr to fix

      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_path_for_new_parent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _set_path_for_new_parent(target, value, oldvalue, initiator):
          """Triggered whenever the Node's 'parent' attribute is set.
          """
          if value is None or value == oldvalue:
              # The parent is about to be set to 'None', so skip.
      Severity: Minor
      Found in kotti/events.py - About 1 hr to fix

      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 upgrade has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def upgrade():
          from depot.manager import DepotManager
          from depot.fields.upload import UploadedFile
          from sqlalchemy import bindparam, Unicode, Column
      
      
      Severity: Minor
      Found in kotti/alembic/versions/413fa5fcc581_add_filedepot.py - About 1 hr to fix

      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 login has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def login(context, request):
          """ Login view.  Renders either the login or password forgot form templates
          or handles their form submission and redirects to came_from on success.
      
          :result: Either a redirect response or a dictionary passed to the template
      Severity: Minor
      Found in kotti/views/login.py - About 1 hr to fix

      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 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __call__(self):
              api = template_api(self.context, self.request, cp_links=CONTROL_PANEL_LINKS)
      
              api.page_title = _("User Management")
      
      
      Severity: Minor
      Found in kotti/views/users.py - About 1 hr to fix

      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 rename_nodes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def rename_nodes(self):
              """ Rename nodes view. Renders either a view to change the titles and
              names for multiple nodes or handle the changes and get back to the
              referrer of the request.
      
      
      Severity: Minor
      Found in kotti/views/edit/actions.py - About 55 mins to fix

      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 _setup_listeners has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _setup_listeners(settings):
      
          # step 2: setup listeners
      
          for s in settings["kotti.sanitize_on_write"].split():
      Severity: Minor
      Found in kotti/sanitizers.py - About 55 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language