Showing 82 of 91 total issues

Function __call__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, request: Request) -> Response:
        """
        :param request: Current request
        :type request: :class:`kotti.request.Request`

Severity: Minor
Found in kotti/filedepot.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 move_child_position has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def move_child_position(context, request):
    """ Move the child from one position to another.

    :param context: "Container" node in which the child changes its position.
    :type context: :class:kotti.resources.Node or descendant
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 search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def search(self, match: Optional[str] = "any", **kwargs) -> Query:
        """ Search the principal database.

        :param match: ``any`` to return all principals matching any search
                      param, ``all`` to return only principals matching
Severity: Minor
Found in kotti/security.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 register has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def register(context, request):
    schema = RegisterSchema().bind(request=request)
    form = Form(schema, buttons=(Button("register", _("Register")),))
    rendered_form = None

Severity: Minor
Found in kotti/views/login.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in kotti/security.py - About 50 mins to fix

    Function deferred_email_validator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def deferred_email_validator(node, kw):
        def raise_invalid_email(node, value):
            raise colander.Invalid(node, _("A user with that email already exists."))
    
        request = kw["request"]
    Severity: Minor
    Found in kotti/views/users.py - About 45 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Minor
    Found in kotti/filedepot.py - About 45 mins to fix

      Function blank has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def blank(cls, path, environ=None, base_url=None, headers=None, POST=None, **kw):
      Severity: Minor
      Found in kotti/testing.py - About 45 mins to fix

        Function _translate_titles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _translate_titles(info):
            result = []
            for d in info:
                d = d.copy()
                try:
        Severity: Minor
        Found in kotti/views/edit/__init__.py - About 45 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 set_default_view has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_default_view(self):
                """
                :summary: Set the node's default view and redirect to it.
                :result: Redirect to the context URL.
                :rtype: pyramid.httpexceptions.HTTPFound
        Severity: Minor
        Found in kotti/views/edit/default_views.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                for child in childs:
                                    wf = get_workflow(child)
                                    if wf is not None:
                                        wf.transition_to_state(child, self.request, to_state)
                        self.flash(_("Your changes have been saved."), "success")
        Severity: Major
        Found in kotti/views/edit/actions.py - About 45 mins to fix

          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Minor
          Found in kotti/resources.py - About 45 mins to fix

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Minor
            Found in kotti/filedepot.py - About 45 mins to fix

              Function __call__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __call__(self, event):
                      results = []
                      for (evtype, objtype), handlers in self.items():
                          if isinstance(event, evtype) and (
                              objtype is None or isinstance(event.object, objtype)
              Severity: Minor
              Found in kotti/events.py - About 45 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 set_visibility has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def set_visibility(self, show):
                      """ Do the real work to set the visibility of nodes in the menu. Called
                      by the show and the hide view.
              
                      :result: Redirect response to the referrer of the request.
              Severity: Minor
              Found in kotti/views/edit/actions.py - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                      if tran_info not in transitions:
                                          transitions.append(tran_info)
                      return {
              Severity: Major
              Found in kotti/views/edit/actions.py - About 45 mins to fix

                Function _to_fieldstorage has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _to_fieldstorage(fp, filename, mimetype, size, **_kwds):
                Severity: Minor
                Found in kotti/util.py - About 35 mins to fix

                  Function render_view has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def render_view(self, name="", context=None, request=None, secure=True, bare=True):
                  Severity: Minor
                  Found in kotti/views/util.py - About 35 mins to fix

                    Function email_set_password has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def email_set_password(
                    Severity: Minor
                    Found in kotti/message.py - About 35 mins to fix

                      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def __init__(
                      Severity: Minor
                      Found in kotti/resources.py - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language