edgewall/trac

View on GitHub

Showing 1,049 of 1,371 total issues

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 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 __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

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

    def run(self):
        """Begin processing data from the socket."""
        self._keepGoing = True
        while self._keepGoing:
            try:
Severity: Minor
Found in trac/web/_fcgi.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 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 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 get_available_actions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_available_actions(self, req, ticket):
            """Returns a sorted list of available actions"""
            # The list should not have duplicates.
            actions = {}
            for controller in self.action_controllers:
    Severity: Minor
    Found in trac/ticket/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

    Avoid deeply nested control flow statements.
    Open

                            for name in sel:
                                milestone = model.Milestone(self.env, name)
                                milestone.move_tickets(None, req.authname,
                                                       "Milestone deleted")
                                milestone.delete()
    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

        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

                                  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 __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

                                      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 newv:
                                            change_data[field] = {'oldvalue': old,
                                                                  'newvalue': new}
                
                
                Severity: Major
                Found in trac/ticket/notification.py - About 45 mins to fix

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

                      def execute_paginated_report(self, req, id, sql, args, limit=0, offset=0):
                  Severity: Minor
                  Found in trac/ticket/report.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if a == b:
                                                    ids.append(str(a))
                                                else:
                                                    id_clauses.append('t.id BETWEEN %s AND %s')
                                                    args.append(a)
                    Severity: Major
                    Found in trac/ticket/query.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if prev_t == t:
                                                  ticket = ev[3][0]
                                                  batch_ev[3][0].append(ticket.id)
                                              else:
                                                  yield batch_ev
                      Severity: Major
                      Found in trac/ticket/web_ui.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
                            Severity
                            Category
                            Status
                            Source
                            Language