Showing 82 of 91 total issues

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

    def initialize_sql(engine: Engine, drop_all: bool = False) -> scoped_session:
        DBSession.registry.clear()
        DBSession.configure(bind=engine)
        metadata.bind = engine
    
    
    Severity: Minor
    Found in kotti/resources.py - About 35 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 delete_nodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def delete_nodes(self):
            """ Delete nodes view. Renders either a view to delete multiple nodes or
            delete the selected nodes and get back to the referrer of the request.
    
            :result: Either a redirect response or a dictionary passed to the
    Severity: Minor
    Found in kotti/views/edit/actions.py - About 35 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 copy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def copy(self, **kwargs) -> "Node":
            """
            :result: A copy of the current instance
            :rtype: :class:`~kotti.resources.Node`
            """
    Severity: Minor
    Found in kotti/resources.py - About 35 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 contents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def contents(context, request):
        """ Contents view. Renders either the contents view or handle the action
        button actions of the view.
    
        :result: Either a redirect response or a dictionary passed to the
    Severity: Minor
    Found in kotti/views/edit/actions.py - About 35 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, **kwargs) -> None:
            if "action_links" in kwargs:
                msg = (
                    "'action_links' is deprecated as of Kotti 1.0.0.  "
                    "'edit_links' includes 'action_links' and should "
    Severity: Minor
    Found in kotti/resources.py - About 35 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(
            self,
            f: MemoryStoredFile,
            request: Request,
            disposition: str = "attachment",
    Severity: Minor
    Found in kotti/filedepot.py - About 35 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 kotti_migrate_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def kotti_migrate_command():
        __doc__ = """Migrate Kotti and Kotti add-ons.
    
        Usage:
          kotti-migrate <config_uri> list_all
    Severity: Minor
    Found in kotti/migrate.py - About 35 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 _find_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def _find_user(login):
        principals = get_principals()
        principal = principals.get(login)
        if principal is not None:
            return principal
    Severity: Minor
    Found in kotti/views/login.py - About 35 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 too many return statements within this function.
    Open

            return response
    Severity: Major
    Found in kotti/filedepot.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return response
      Severity: Major
      Found in kotti/filedepot.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return "Cache Media Content"
        Severity: Major
        Found in kotti/views/cache.py - About 30 mins to fix

          Function reset_workflow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def reset_workflow(objs=None, purge_existing=False):
              if objs is None:
                  objs = DBSession.query(Content)
              for obj in objs:
                  if purge_existing:
          Severity: Minor
          Found in kotti/workflow.py - About 25 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 get_appstruct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_appstruct(context, schema):
              appstruct = {}
              for field in schema.children:
                  if hasattr(context, field.name):
                      val = getattr(context, field.name)
          Severity: Minor
          Found in kotti/views/form.py - About 25 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 process_bind_param has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_bind_param(self, value, dialect):
                  if value is not None:
                      value = [list(ace) for ace in value if ace != self.DEFAULT_ACE]
                      for ace in value:
                          if ace[2] == ALL_PERMISSIONS:
          Severity: Minor
          Found in kotti/sqla.py - About 25 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 process_result_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_result_value(self, value, dialect):
                  acl = super().process_result_value(value, dialect)
                  if acl is not None:
                      for ace in acl:
                          if ace[2] == self.ALL_PERMISSIONS_SERIALIZED:
          Severity: Minor
          Found in kotti/sqla.py - About 25 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 list_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def list_all():
              pkg_envs = [PackageEnvironment(location) for location in get_locations()]
              for pkg_env in pkg_envs:
                  print(f"{pkg_env.pkg_name}:")
          
          
          Severity: Minor
          Found in kotti/migrate.py - About 25 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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def __call__(self, event):
                  results = []
                  for event_type, handlers in self.items():
                      if isinstance(event, event_type):
                          for handler in handlers:
          Severity: Minor
          Found in kotti/events.py - About 25 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 default_caching_policy_chooser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def default_caching_policy_chooser(context, request, response):
              if request.method != "GET" or response.status_int != 200:
                  return None
              elif isinstance(response, FileResponse):
                  return "Cache Resource"
          Severity: Minor
          Found in kotti/views/cache.py - About 25 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_cache_headers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def set_cache_headers(event):
              request, response = event.request, event.response
          
              # this can happen if a Pyramid tween will shortcut the normal tween
              # chain processing and return its own response early
          Severity: Minor
          Found in kotti/views/cache.py - About 25 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