edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

DatabaseManager has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class DatabaseManager(Component):
    """Component used to manage the `IDatabaseConnector` implementations."""

    implements(IEnvironmentSetupParticipant, ISystemInfoProvider)

Severity: Minor
Found in trac/db/api.py - About 3 hrs to fix

    Function modify_repository has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def modify_repository(self, reponame, changes):
            """Modify attributes of a repository."""
            if is_default(reponame):
                reponame = ''
            new_reponame = changes.get('name', reponame)
    Severity: Minor
    Found in trac/versioncontrol/api.py - About 3 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 interwiki_map has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def interwiki_map(self):
            """Map from upper-cased namespaces to (namespace, prefix, title)
            values.
            """
            from trac.wiki.model import WikiPage
    Severity: Minor
    Found in trac/wiki/interwiki.py - About 3 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 get_first_week_day_jquery_ui has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_first_week_day_jquery_ui(req):
        """Get first week day for jQuery date picker"""
        locale = req.lc_time
        if locale == 'iso8601':
            return 1 # Monday
    Severity: Minor
    Found in trac/util/datefmt.py - About 3 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 expand_macro has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def expand_macro(self, formatter, name, content):
            min_depth, max_depth = 1, 6
            title = None
            inline = False
            numbered = True
    Severity: Minor
    Found in trac/wiki/macros.py - About 3 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 _i18n_parse_date_pattern has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def _i18n_parse_date_pattern(locale):
        format_keys = {
            'y': ('y', 'Y'),
            'M': ('M',),
            'd': ('d',),
    Severity: Minor
    Found in trac/util/datefmt.py - About 3 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_preference_panel has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def render_preference_panel(self, req, panel, path_info=None):
            if req.method == 'POST':
                action_arg = req.args.getfirst('action', '').split('_', 1)
                if len(action_arg) == 2:
                    action, arg = action_arg
    Severity: Minor
    Found in trac/notification/prefs.py - About 3 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 send_internal_error has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def send_internal_error(env, req, exc_info):
        if env:
            env.log.error("[%s] Internal Server Error: %r, referrer %r%s",
                          req.remote_addr, req, req.environ.get('HTTP_REFERER'),
                          exception_to_unicode(exc_info[1], traceback=True))
    Severity: Minor
    Found in trac/web/main.py - About 3 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 _fetch_ticket has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def _fetch_ticket(self, tkt_id):
            row = None
            if self.id_is_valid(tkt_id):
                # Fetch the standard ticket fields
                tkt_id = int(tkt_id)
    Severity: Minor
    Found in trac/ticket/model.py - About 3 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 get_default_columns has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_default_columns(self):
            cols = self.get_all_columns()
    
            # Semi-intelligently remove columns that are restricted to a single
            # value by a query constraint.
    Severity: Minor
    Found in trac/ticket/query.py - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_request(self, req):
            # did the user ask for any special report?
            id = req.args.getint('id', self.REPORT_LIST_ID)
            req.perm(self.realm, id).require('REPORT_VIEW')
    
    
    Severity: Minor
    Found in trac/ticket/report.py - About 3 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 addWikiFormattingToolbar has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      window.addWikiFormattingToolbar = function(textarea) {
        if ((document.selection == undefined)
         && (textarea.setSelectionRange == undefined)) {
          return;
        }
    Severity: Major
    Found in trac/htdocs/js/wikitoolbar.js - About 3 hrs to fix

      Function native_path has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      def native_path(path):
          """Converts a Windows-style or POSIX-style path to the native style.
      
          i.e. on Windows, convert POSIX path to Windows path, and in a
          POSIX system, convert Windows path to POSIX path.
      Severity: Minor
      Found in trac/util/__init__.py - About 3 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_help has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_help(self, line=None):
              arg = self.arg_tokenize(line)
              if arg[0]:
                  cmd_mgr = None
                  doc = getattr(self, "_help_" + arg[0], None)
      Severity: Minor
      Found in trac/admin/console.py - About 3 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 set_defaults has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_defaults(self, compmgr=None, component=None):
              """Retrieve all default values and store them explicitly in the
              configuration, so that they can be saved to file.
      
              Values already set in the configuration are not overwritten.
      Severity: Minor
      Found in trac/config.py - About 3 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 load_py_files has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_py_files():
          """Loader that look for Python source files in the plugins directories,
          which simply get imported, thereby registering them with the component
          manager if they define any components.
          """
      Severity: Minor
      Found in trac/loader.py - About 3 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 _setupSocket has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def _setupSocket(self):
              if self._bindAddress is None: # Run as a normal FastCGI?
                  isFCGI = True
      
                  sock = socket.fromfd(FCGI_LISTENSOCK_FILENO, socket.AF_INET,
      Severity: Minor
      Found in trac/web/_fcgi.py - About 3 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 get_repository has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_repository(self, type, dir, params):
              """GitRepository factory method"""
              assert type == 'git'
      
              if not (4 <= self.shortrev_len <= 40):
      Severity: Minor
      Found in tracopt/versioncontrol/git/git_fs.py - About 3 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 enableBlame has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        window.enableBlame = function(url, reponame, original_path) {
          var message = null;
          var message_rev = null;
      
          /* for each blame cell... */
      Severity: Major
      Found in trac/htdocs/js/blame.js - About 3 hrs to fix

        File web_ui.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        #
        # Copyright (C) 2003-2023 Edgewall Software
        # Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
        # Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
        Severity: Minor
        Found in trac/timeline/web_ui.py - About 3 hrs to fix
          Severity
          Category
          Status
          Source
          Language