edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

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

def web_context(req, resource=None, id=False, version=False, parent=False,
Severity: Minor
Found in trac/web/chrome.py - About 45 mins to fix

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

        def load(self, filename):
            """Load account information from apache style htdigest files,
            only users from the specified realm are used
            """
            # FIXME use a logger
    Severity: Minor
    Found in trac/web/auth.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 code_block_role has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def code_block_role(name, rawtext, text, lineno, inliner, options={},
                            content=[]):
            if not hasattr(inliner, 'trac'):
                return [], []
            env, context = inliner.trac
    Severity: Minor
    Found in trac/mimeview/rst.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 arg_list_to_args has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def arg_list_to_args(arg_list):
        """Convert a list of `(name, value)` tuples into into a `_RequestArgs`."""
        args = _RequestArgs()
        for name, value in arg_list:
            if name in args:
    Severity: Minor
    Found in trac/web/api.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 do_auth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_auth(self, environ, start_response):
            header = environ.get('HTTP_AUTHORIZATION')
            if not header or not header.startswith('Digest'):
                self.send_auth_request(environ, start_response)
                return None
    Severity: Minor
    Found in trac/web/auth.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 _redirect_back has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _redirect_back(self, req):
            """Redirect the user back to the URL she came from."""
            referer = self._referer(req)
            if referer:
                if not referer.startswith(('http://', 'https://')):
    Severity: Minor
    Found in trac/web/auth.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 _types has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _types(self):
            types = {}
            for lexer_name, aliases, _, mimetypes in get_all_lexers():
                name = aliases[0] if aliases else lexer_name
                for mimetype in mimetypes:
    Severity: Minor
    Found in trac/mimeview/pygments.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 __setitem__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __setitem__(self, name, value):
            """Log ticket modifications so the table ticket_change can be updated
            """
            if value and name not in self.time_fields:
                if isinstance(value, list):
    Severity: Minor
    Found in trac/ticket/model.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 href is not None:
                                result['href'] = href.ticket(val)
                        elif name in self.time_fields:
    Severity: Major
    Found in trac/ticket/query.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if user:
                                  vals[i] = val.replace('$USER', user)
                              elif val.endswith('$USER'):
                                  del clause[field]
                                  break
      Severity: Major
      Found in trac/ticket/query.py - About 45 mins to fix

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

            def __init__(self, targets, time, author, comment, new_values, action):
        Severity: Minor
        Found in trac/ticket/notification.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if newv:
                                      change_data[field] = {'oldvalue': old,
                                                            'newvalue': new}
          
          
          Severity: Major
          Found in trac/ticket/notification.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for name in sel:
                                        self._enum_cls(self.env, name).delete()
                                        if name == default:
                                            self.config.set('ticket',
                                                            'default_%s' % self._type, '')
            Severity: Major
            Found in trac/ticket/admin.py - About 45 mins to fix

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

              def milestone_stats_data(env, req, stat, name, grouped_by='component',
              Severity: Minor
              Found in trac/ticket/roadmap.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if not word:
                                                continue
                                        clauses.append("COALESCE(%s,'') %s%s" % (col, cneg,
                Severity: Major
                Found in trac/ticket/query.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for name in sel:
                                              model.Version(self.env, name).delete()
                                              if name == default:
                                                  self.config.set('ticket',
                                                                  'default_version', '')
                  Severity: Major
                  Found in trac/ticket/admin.py - About 45 mins to fix

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

                        def _send_csv(self, req, cols, rows, sep=',', mimetype='text/plain',
                    Severity: Minor
                    Found in trac/ticket/report.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if field == 'description':
                                                  new_descr = wrap(new, self.COLS, ' ', ' ', '\n',
                                                                   self.ambiwidth)
                                                  old_descr = wrap(old, self.COLS, '> ', '> ', '\n',
                                                                   self.ambiwidth)
                      Severity: Major
                      Found in trac/ticket/notification.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                for enum in self._enum_cls.select(self.env):
                                                    new_value = order[enum.value]
                                                    if new_value != enum.value:
                                                        enum.value = new_value
                                                        enum.update()
                        Severity: Major
                        Found in trac/ticket/admin.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if ends:
                                                      vals = [start + '..' + end
                                                              for (start, end) in zip(vals, ends)]
                                              if k in remove_constraints:
                          Severity: Major
                          Found in trac/ticket/query.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language