edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

BrowserModule has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class BrowserModule(Component):

    implements(INavigationContributor, IPermissionRequestor, IRequestHandler,
               IWikiSyntaxProvider, IHTMLPreviewAnnotator,
               IWikiMacroProvider)
Severity: Minor
Found in trac/versioncontrol/web_ui/browser.py - About 3 hrs to fix

    GitRepository has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class GitRepository(Repository):
        """Git repository"""
    
        def __init__(self, env, path, params, log,
                     persistent_cache=False,
    Severity: Minor
    Found in tracopt/versioncontrol/git/git_fs.py - About 3 hrs to fix

      Function html_attribute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def html_attribute(key, val):
          """Returns the actual value for the attribute ``key``, for the given
          ``value``.
      
          This follows the rules described in the HTML5_ spec (Double-quoted
      Severity: Minor
      Found in trac/util/html.py - About 2 hrs 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 write_js has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def write_js(fileobj, catalog, domain, locale):
              from trac.util.presentation import to_json
              data = {'domain': domain, 'locale': locale}
      
              messages = {}
      Severity: Minor
      Found in trac/dist.py - About 2 hrs 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_request has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_request(self, req):
              parent_realm = req.args.get('realm')
              path = req.args.get('path')
      
              if not parent_realm or not path:
      Severity: Minor
      Found in trac/attachment.py - About 2 hrs 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 has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _move(self, new_realm=None, new_id=None, new_filename=None,
                    new_parent_must_exist=False):
              """Move the attachment, changing one or more of its parent realm,
              parent id and filename.
      
      
      Severity: Minor
      Found in trac/attachment.py - About 2 hrs 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 _do_update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _do_update(self, req):
              """Update component enable state."""
              components = req.args.getlist('component')
              enabled = req.args.getlist('enable')
              added, removed = [], []
      Severity: Minor
      Found in trac/admin/web_ui.py - About 2 hrs 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 __new__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def __new__(cls, resource_or_realm=None, id=False, version=False,
                      parent=False):
              """Create a new Resource object from a specification.
      
              :param resource_or_realm: this can be either:
      Severity: Minor
      Found in trac/resource.py - About 2 hrs 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 _write has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _write(self, data):
              assert self.headers_set, 'Response not started'
              if self.handler.wfile.closed:
                  return # don't write to an already closed file (fix for #1183)
      
      
      Severity: Minor
      Found in trac/web/wsgi.py - About 2 hrs 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 render_template has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_template(self, req, filename, data, metadata):
              """Renders the ``filename`` template using ``data`` for the context.
      
              It attempts to load a Jinja2 template, augments the provided
              *data* with standard data, and renders it according to the
      Severity: Minor
      Found in trac/web/chrome.py - About 2 hrs 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 run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self, timeout=1.0):
              """
              The main loop. Exits on SIGHUP, SIGINT, SIGTERM. Returns True if
              SIGHUP was received, False otherwise.
              """
      Severity: Minor
      Found in trac/web/_fcgi.py - About 2 hrs 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 _render_link has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _render_link(self, context, name, label, extra=''):
              if not (name or extra):
                  return tag()
              try:
                  milestone = Milestone(self.env, name)
      Severity: Minor
      Found in trac/ticket/roadmap.py - About 2 hrs 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 authz_permissions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def authz_permissions(self, resource_key, username):
              # TODO: Handle permission negation in sections. eg. "if in this
              # ticket, remove TICKET_MODIFY"
              if username and username != 'anonymous':
                  valid_users = ['*', 'authenticated', 'anonymous', username]
      Severity: Minor
      Found in tracopt/perm/authz_policy.py - About 2 hrs 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 check_api_doc has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_api_doc(basename, verbose, only_documented, has_submodules):
          module_name = basename.replace('_', '.')
          try:
              module = importlib.import_module(module_name)
          except ImportError as e:
      Severity: Minor
      Found in doc/utils/checkapidoc.py - About 2 hrs 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

      File diff.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      #
      # Copyright (C) 2004-2023 Edgewall Software
      # Copyright (C) 2004-2006 Christopher Lenz <cmlenz@gmx.de>
      # All rights reserved.
      Severity: Minor
      Found in trac/versioncontrol/diff.py - About 2 hrs to fix

        MilestoneModule has 25 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class MilestoneModule(Component):
            """View and edit individual milestones."""
        
            implements(INavigationContributor, IPermissionRequestor, IRequestHandler,
                       IResourceManager, ISearchSource, ITimelineEventProvider,
        Severity: Minor
        Found in trac/ticket/roadmap.py - About 2 hrs to fix

          Function autoSubmit has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            $.fn.autoSubmit = function(args, update, busy) {
              if (this.length == 0 || auto_preview_timeout <= 0)
                return this;
              if (this[0].nodeName == 'FORM') {
                var form = this;
          Severity: Major
          Found in trac/htdocs/js/auto_preview.js - About 2 hrs to fix

            Function _get_connector has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def _get_connector(self, rtype):
                    """Retrieve the appropriate connector for the given repository type.
            
                    Note that the self._lock must be held when calling this method.
                    """
            Severity: Minor
            Found in trac/versioncontrol/api.py - About 2 hrs 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 render_zip has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def render_zip(req, filename, repos, root_node, iter_nodes):
                """Send a ZIP file containing the data corresponding to the `nodes`
                iterable.
            
                :type root_node: `~trac.versioncontrol.api.Node`
            Severity: Minor
            Found in trac/versioncontrol/web_ui/util.py - About 2 hrs 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 _run has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            def _run(args):
                if args is None:
                    args = sys.argv[1:]
                admin = TracAdmin()
                if args:
            Severity: Minor
            Found in trac/admin/console.py - About 2 hrs 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