edgewall/trac

View on GitHub

Showing 1,048 of 1,370 total issues

File admin.py has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2023 Edgewall Software
# All rights reserved.
#
Severity: Minor
Found in trac/versioncontrol/admin.py - About 4 hrs to fix

    File postgres_backend.py has 353 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File translation.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      #
      # Copyright (C) 2007-2023 Edgewall Software
      # All rights reserved.
      #
      Severity: Minor
      Found in trac/util/translation.py - About 4 hrs to fix

        Function make_log_graph has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

        def make_log_graph(repos, revs):
            """Generate graph information for the given revisions.
        
            Returns a tuple `(threads, vertices, columns)`, where:
        
        
        Severity: Minor
        Found in trac/versioncontrol/web_ui/util.py - About 4 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 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def expand_macro(self, formatter, name, content):
                from trac.config import ConfigSection, Option
        
                args, kw = parse_args(content)
                filters = {}
        Severity: Minor
        Found in trac/wiki/macros.py - About 4 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_0 has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

        def _i18n_parse_date_0(text, order, regexp, period_names, month_names, tzinfo):
            matches = regexp.findall(text)
            if not matches:
                return None
        
        
        Severity: Minor
        Found in trac/util/datefmt.py - About 4 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_ticket_changes has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_ticket_changes(self, req, ticket, action):
                this_action = self.actions[action]
        
                # Enforce permissions
                if not self._is_action_allowed(req, this_action, ticket.resource):
        Severity: Minor
        Found in trac/ticket/default_workflow.py - About 4 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 _populate has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            def _populate(self, req, ticket, plain_fields=False):
                if not plain_fields:
                    fields = {k[6:]: req.args.get(k) for k in req.args
                              if k.startswith('field_') and
                                 'revert_' + k[6:] not in req.args}
        Severity: Minor
        Found in trac/ticket/web_ui.py - About 4 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 main has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

        def main():
            """
            %(prog)s [-c] passwordfile realm username
            %(prog)s -b[c] passwordfile realm username password\
            """
        Severity: Minor
        Found in contrib/htdigest.py - About 4 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 format has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def format(self, text, out, shorten=False):
                if not text:
                    return
                text = self.reset(text, out)
        
        
        Severity: Minor
        Found in trac/wiki/formatter.py - About 4 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 __init__ has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, formatter, name, args=None):
                """Find the processor by name
        
                :param formatter: the formatter embedding a call for this processor
                :param name: the name of the processor
        Severity: Minor
        Found in trac/wiki/formatter.py - About 4 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 grouped_changelog_entries has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def grouped_changelog_entries(self, ticket, when=None):
                """Iterate on changelog entries, consolidating related changes
                in a `dict` object.
                """
                field_labels = TicketSystem(self.env).get_ticket_field_labels()
        Severity: Minor
        Found in trac/ticket/web_ui.py - About 4 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 save_milestone has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def save_milestone(self, req, milestone):
                # Instead of raising one single error, check all the constraints
                # and let the user fix them by going back to edit mode and showing
                # the warnings
                warnings = []
        Severity: Minor
        Found in trac/ticket/roadmap.py - About 4 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 _export_csv has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def _export_csv(self, req, query, sep=',', mimetype='text/plain'):
                def iterate():
                    out = io.BytesIO()
                    writer = csv.writer(io.TextIOWrapper(out, encoding='utf-8',
                                                         newline='\n',
        Severity: Minor
        Found in trac/ticket/query.py - About 4 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 parse_authz has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_authz(self):
                self.log.debug("Parsing authz security policy %s",
                               self.authz_file)
        
                if not self.authz_file:
        Severity: Minor
        Found in tracopt/perm/authz_policy.py - About 4 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 _read_substitute has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            def _read_substitute(self, stream, n):
                if n is None:
                    n = -1
        
                buffer = self.buffer
        Severity: Minor
        Found in tracopt/versioncontrol/svn/svn_fs.py - About 4 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 resource.py has 339 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        #
        # Copyright (C) 2006-2023 Edgewall Software
        # Copyright (C) 2006-2007 Alec Thomas <alec@swapoff.org>
        # Copyright (C) 2007 Christian Boos <cboos@edgewall.org>
        Severity: Minor
        Found in trac/resource.py - About 4 hrs to fix

          Function _do_deploy has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def _do_deploy(self, dest):
                  target = os.path.normpath(dest)
                  chrome_target = os.path.join(target, 'htdocs')
                  script_target = os.path.join(target, 'cgi-bin')
                  chrome = Chrome(self.env)
          Severity: Minor
          Found in trac/env.py - About 4 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 notify has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def notify(self, event, reponame, revs):
                  """Notify repositories and change listeners about repository events.
          
                  The supported events are the names of the methods defined in the
                  `IRepositoryChangeListener` interface.
          Severity: Minor
          Found in trac/versioncontrol/api.py - About 4 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 _format_link has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def _format_link(self, formatter, ns, match, label, fullmatch=None):
                  if ns == 'log1':
                      groups = fullmatch.groupdict()
                      it_log = groups.get('it_log')
                      revs = groups.get('log_revs')
          Severity: Minor
          Found in trac/versioncontrol/web_ui/log.py - About 4 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