edgewall/trac

View on GitHub

Showing 1,048 of 1,370 total issues

Avoid deeply nested control flow statements.
Open

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

    Avoid deeply nested control flow statements.
    Open

                            for keyword in kwds:
                                self._mime_map[keyword] = mimetype
                # augment/override mime_map from trac.ini
                for mapping in self.config['mimeviewer'].getlist('mime_map'):
    Severity: Major
    Found in trac/mimeview/api.py - About 45 mins to fix

      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 add_meta has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def add_meta(req, content, http_equiv=None, name=None, scheme=None, lang=None):
      Severity: Minor
      Found in trac/web/chrome.py - About 45 mins to fix

        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

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

            def _get_list(self, sids):
                all_anon = 'anonymous' in sids or '*' in sids
                all_auth = 'authenticated' in sids or '*' in sids
                sids = {self._split_sid(sid)
                        for sid in sids
        Severity: Minor
        Found in trac/web/session.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 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 _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 0 <= idx < len(vals):
                                        del vals[idx]
                                        if not vals:
                                            continue
                                    else:
            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

                                        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

                  Avoid deeply nested control flow statements.
                  Open

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

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

                              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

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

                                    def _query_link(self, req, name, value, text=None, class_=None, query=None):
                                Severity: Minor
                                Found in trac/ticket/web_ui.py - About 45 mins to fix

                                  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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language