edgewall/trac

View on GitHub

Showing 1,048 of 1,370 total issues

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

    def __init__(self, section, name, default=None, doc='',
Severity: Minor
Found in trac/config.py - About 45 mins to fix

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

        def __init__(self, default_data=False, enable=None, disable=None,
    Severity: Minor
    Found in trac/test.py - About 45 mins to fix

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

          def add(cls, env, sid, authenticated, class_, realm, targets):
      Severity: Minor
      Found in trac/notification/model.py - About 45 mins to fix

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

            def _collist(self, table, columns, max_bytes):
                """Take a list of columns and impose limits on each so that indexing
                works properly.
        
                Some Versions of MySQL limit each index prefix to 3072 bytes total,
        Severity: Minor
        Found in trac/db/mysql_backend.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 __new__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def __new__(mcs, name, bases, d):
                """Create the component class."""
        
                new_class = type.__new__(mcs, name, bases, d)
                if name == 'Component':
        Severity: Minor
        Found in trac/core.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 get_change has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_change(self, cnum=None, cdate=None):
                """Return a ticket change by its number or date.
                """
                if cdate is None:
                    row = self._find_change(cnum)
        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

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

            def _send_headers(self):
                assert self.headers_set, 'Response not started'
        
                if not self.headers_sent:
                    status, headers = self.headers_sent = self.headers_set
        Severity: Minor
        Found in trac/web/modpython_frontend.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 side == 'base':
                                        fromline += 1
                                    else:
                                        toline += 1
                                    block[side]['lines'].append(line)
        Severity: Major
        Found in trac/mimeview/patch.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if 'meta' in changed and i in changed['meta']:
                                      t[i] = Markup('<em>%s</em>') % t[i]
                  return changes
          Severity: Major
          Found in trac/mimeview/patch.py - About 45 mins to fix

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

                def __init__(self, req, options):
                    environ = {}
                    environ.update(apache.build_cgi_env(req))
            
                    environ['trac.web.frontend'] = 'mod_python'
            Severity: Minor
            Found in trac/web/modpython_frontend.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 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 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 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 get_supported_conversions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_supported_conversions(self, mimetype):
                    """Return a list of target MIME types as instances of the `namedtuple`
                    `MimeConversion`. Output is ordered from best to worst quality.
            
                    The `MimeConversion` `namedtuple` has fields: key, name, extension,
            Severity: Minor
            Found in trac/mimeview/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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, env, tkt_id=None, version=None):
                    self.env = env
                    self.fields = TicketSystem(self.env).get_ticket_fields()
                    self.editable_fields = \
                        {f['name'] for f in self.fields
            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 old_db_val is None:
                                        field = self.fields.by_name(name)
                                        default = self._custom_field_default(field)
                                        if self.values.get(name) == default:
                                            continue
            Severity: Major
            Found in trac/ticket/model.py - About 45 mins to fix

              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 __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 len(f) == 0:
                                          b['type'] = 'add'
                                      elif len(t) == 0:
                                          b['type'] = 'rem'
                                      elif len(f) == len(t):
              Severity: Major
              Found in trac/mimeview/patch.py - About 45 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language