edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

Function export_csv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def export_csv(self, req, ticket, sep=',', mimetype='text/plain'):
        # FIXME: consider dumping history of changes here as well
        #        as one row of output doesn't seem to be terribly useful...
        fields = [f for f in ticket.fields
                  if f['name'] not in ('time', 'changetime')]
Severity: Minor
Found in trac/ticket/web_ui.py - About 35 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 render_ticket_action_control has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def render_ticket_action_control(self, req, ticket, action):
        actions = ConfigurableTicketWorkflow(self.env).actions
        label = actions[action]['label']
        hint = None
        old_milestone = ticket._old.get('milestone')
Severity: Minor
Found in sample-plugins/workflow/MilestoneOperation.py - About 35 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 _translate_keyword has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _translate_keyword(self, text, match):
        keyword = match.group('keyword')
        value = self.keywords.get(keyword)
        if value is None:
            return text
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_fs.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, path, rev, repos, pool=None, parent_root=None):
        self.fs_ptr = repos.fs_ptr
        self.scope = repos.scope
        self.pool = Pool(pool)
        pool = self.pool
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_fs.py - About 35 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_changed_revs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_changed_revs(self, node_infos):
        path_revs = {}
        for node, first in node_infos:
            path = node.path
            revs = []
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_fs.py - About 35 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_blocked_revs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _get_blocked_revs(props, name, path):
    """Return the revisions blocked from merging for the given property
    name and path.
    """
    if name == 'svnmerge-integrated':
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_prop.py - About 35 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 print_statement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def print_statement(filename, s, warn=None, quiet=False):
    if not quiet:
        print('%5d %s %s%s%s%s' % (s.linenum,
                                   ' ' * s.indent,
                                   '}' if s.end else
Severity: Minor
Found in contrib/jinjachecker.py - About 35 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_permission_actions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_permission_actions(self):
        permissions = {}
        for meta, perms in self.extra_permissions_section.options():
            perms = [each.strip().upper() for each in perms.split(',')]
            for perm in perms:
Severity: Minor
Found in tracopt/perm/config_perm_provider.py - About 35 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 main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    names = sorted(name for name in resource_listdir('trac.wiki',
                                                     'default-pages')
                        if not name.startswith('.'))

Severity: Minor
Found in contrib/wiki2rst.py - About 35 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_search_terms has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_search_terms(self, query):
        """Break apart a search query into its various search terms.

        Terms are grouped implicitly by word boundary, or explicitly by (single
        or double) quotes.
Severity: Minor
Found in trac/search/web_ui.py - About 35 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 too many return statements within this function.
Open

            return True
Severity: Major
Found in trac/versioncontrol/api.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return False
    Severity: Major
    Found in trac/versioncontrol/api.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return True
      Severity: Major
      Found in trac/versioncontrol/diff.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return _("Repository %(repo)s", repo=resource.id)
        Severity: Major
        Found in trac/versioncontrol/api.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return True
          Severity: Major
          Found in trac/versioncontrol/svn_authz.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return check_path(resource.id)
            Severity: Major
            Found in trac/versioncontrol/svn_authz.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return self._render_edit_comment(req, versioned_page)
              Severity: Major
              Found in trac/wiki/web_ui.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return self._make_ext_link(ns + ':' + target, label)
                Severity: Major
                Found in trac/wiki/formatter.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return escape(match)
                  Severity: Major
                  Found in trac/wiki/formatter.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return diff_blocks(old_content.splitlines(),
                    Severity: Major
                    Found in trac/versioncontrol/web_ui/changeset.py - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language