edgewall/trac

View on GitHub

Showing 1,049 of 1,371 total issues

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

    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

                              if cnum == 'description':
                                  title = _("Description for #%(id)s: %(summary)s",
                                            id=resource.id, summary=summary)
                              else:
                                  title = _("Comment %(cnum)s for #%(id)s: "
      Severity: Major
      Found in trac/ticket/api.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

          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

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

                def _render_property_diff(self, req, ticket, field, old, new,
            Severity: Minor
            Found in trac/ticket/web_ui.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      with self.env.db_query as db:
                                          for name, value in db(
                                                  "SELECT name, %s FROM enum WHERE type=%%s"
                                                  % db.cast('value', 'int'),
                                                  (sort_col,)):
              Severity: Major
              Found in trac/ticket/report.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

                                          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 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 expand_macro has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def expand_macro(self, formatter, name, content, args=None):
                              args = args or {}
                              reponame = args.get('repository') or ''
                              rev = args.get('revision')
                              repos = RepositoryManager(self.env).get_repository(reponame)
                      Severity: Minor
                      Found in tracopt/ticket/commit_updater.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 not data:
                                              break
                                          m.update(data)
                      Severity: Major
                      Found in contrib/checksum.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if k not in values:
                                                    values[k] = v['old']
                                            skip = True
                        Severity: Major
                        Found in trac/ticket/web_ui.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if ev:
                                                      yield ev
                          
                                      # Attachments
                                      if 'ticket_details' in filters:
                          Severity: Major
                          Found in trac/ticket/web_ui.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    for k, v in change['fields'].items():
                                                        values[k] = v['new']
                                                if 'description' in change['fields']:
                            Severity: Major
                            Found in trac/ticket/web_ui.py - About 45 mins to fix

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

                                  def next_rev(self, rev, path='', find_initial_rev=False):
                                      """Return revision immediately following `rev`, eventually below
                                      given `path` or globally.
                                      """
                                      rev = self.normalize_rev(rev)
                              Severity: Minor
                              Found in tracopt/versioncontrol/svn/svn_fs.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 milestone_changed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def milestone_changed(self, milestone, old_values):
                                      if not milestone.is_completed or 'completed' not in old_values \
                                              or old_values['completed'] is not None:
                                          return
                                      m = re.match(self.pattern, milestone.name)
                              Severity: Minor
                              Found in sample-plugins/milestone_to_version.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 prev_ev:
                                                          yield prev_ev
                                                      prev_ev = ev
                              Severity: Major
                              Found in trac/ticket/web_ui.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if older[0] == path:
                                                            # still on the path: 'newer' was an edit
                                                            yield newer[0], newer[1], Changeset.EDIT
                                                        else:
                                                            # the path changed: 'newer' was a copy
                                Severity: Major
                                Found in tracopt/versioncontrol/svn/svn_fs.py - About 45 mins to fix

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

                                      def __init__(self, git_dir, log, git_bin='git', git_fs_encoding=None,
                                  Severity: Minor
                                  Found in tracopt/versioncontrol/git/PyGIT.py - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language