edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

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

                            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

      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

        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

                                  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

                                    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

                                      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

                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

                                              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

                                            for next_id, in db(
                                                    "SELECT min(id) FROM ticket WHERE %s < id",
                                                    (ticket.id,)):
                                                add_ticket_link('next', int(next_id))
                                        break
                    Severity: Major
                    Found in trac/ticket/web_ui.py - About 45 mins to fix

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

                          def __init__(self, path, params, log):
                              self.log = log
                              self.pool = Pool()
                      
                              # note that this should usually not happen (str arg expected)
                      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 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 isinstance(permissions, str):
                                                  return [permissions]
                                              else:
                                                  return permissions
                              return None
                      Severity: Major
                      Found in tracopt/perm/authz_policy.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 _format_revision_link has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def _format_revision_link(self, formatter, ns, reponame, rev, label,
                          Severity: Minor
                          Found in sample-plugins/revision_links.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if s.kw == top.kw:
                                                    kw_stack.pop()
                                                else:
                                                    warn.append(("'end%s' misplaced, current block is"
                                                                 " '%s' (at line %d)") %
                            Severity: Major
                            Found in contrib/jinjachecker.py - About 45 mins to fix

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

                                  def get(self, id, retriever, instance):
                                      """Get cached or fresh data for the given id."""
                                      # Get cache metadata
                                      local_meta = self._local.meta
                                      local_cache = self._local.cache
                              Severity: Minor
                              Found in trac/cache.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 strict:
                                                      content = re_box_processor.sub('', content)
                                                  lines = content.replace('\r\n', '\n').splitlines(True)
                              Severity: Major
                              Found in contrib/checkwiki.py - About 45 mins to fix

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language