edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

Function expand_macro has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def expand_macro(self, formatter, name, content):
        req = formatter.req
        query_string, kwargs, format = self.parse_args(content)
        if query_string:
            query_string += '&'
Severity: Minor
Found in trac/ticket/query.py - About 5 hrs 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 process_request has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def process_request(self, req):
        action = req.args.get('action', 'view')
        pagename = req.args.get('page', self.START_PAGE)
        version = None
        if req.args.get('version'):  # Allow version to be empty
Severity: Minor
Found in trac/wiki/web_ui.py - About 5 hrs 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 _iter_diff_lines has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def _iter_diff_lines(self, req, repos, data):
        mimeview = Mimeview(self.env)

        for old_node, new_node, kind, change in repos.get_changes(
                new_path=data['new_path'], new_rev=data['new_rev'],
Severity: Minor
Found in trac/versioncontrol/web_ui/changeset.py - About 5 hrs 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_plugin_info has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

def get_plugin_info(env, include_core=False):
    """Return package information about Trac core and installed plugins."""
    path_sources = {}

    def find_distribution(module):
Severity: Minor
Found in trac/loader.py - About 5 hrs 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 populate_data has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def populate_data(self, req=None, data=None, d=None):
        """Fills a dictionary with the standard set of fields expected
        by templates.

        :param req: a `Request` object; if `None`, no request related fields
Severity: Minor
Found in trac/web/chrome.py - About 5 hrs 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_property_diff has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def _render_property_diff(self, req, ticket, field, old, new,
                              resource_new=None):

        def render_list(elt_renderer, split_list, old, new):
            if not elt_renderer:
Severity: Minor
Found in trac/ticket/web_ui.py - About 5 hrs 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 format has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def format(self, text, out=None, escape_newlines=False):
        text = self.reset(text, out)
        if isinstance(text, str):
            text = text.splitlines()

Severity: Minor
Found in trac/wiki/formatter.py - About 5 hrs 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 37 (exceeds 5 allowed). Consider refactoring.
Open

def main():
    args = parse_args()

    wsgi_app = TracEnvironMiddleware(dispatch_request, args.env_parent_dir,
                                     args.envs, args.single_env)
Severity: Minor
Found in trac/web/standalone.py - About 5 hrs 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 parse_args has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

def parse_args(args=None):
    parser = argparse.ArgumentParser()

    class _AuthAction(argparse.Action):

Severity: Minor
Found in trac/web/standalone.py - About 5 hrs 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 _format_comment_link has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def _format_comment_link(self, formatter, ns, target, label):
        resource = None
        if ':' in target:
            elts = target.split(':')
            if len(elts) == 3:
Severity: Minor
Found in trac/ticket/api.py - About 5 hrs 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

File api.py has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2023 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
Severity: Minor
Found in trac/wiki/api.py - About 5 hrs to fix

    Function parse has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse(authz_file, modules):
        """Parse a Subversion authorization file.
    
        Return a dict of modules, each containing a dict of paths, each containing
        a dict mapping users to permissions. Only modules contained in `modules`
    Severity: Minor
    Found in trac/versioncontrol/svn_authz.py - About 5 hrs 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_table has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def print_table(data, headers=None, sep='  ', out=None, ambiwidth=None):
        """Print data according to a tabular layout.
    
        :param data: a sequence of rows; assume all rows are of equal length.
        :param headers: an optional row containing column headers; must be of
    Severity: Minor
    Found in trac/util/text.py - About 5 hrs 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_eggs has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def load_eggs(entry_point_name):
        """Loader that loads any eggs on the search path and `sys.path`."""
        def _load_eggs(env, search_path, auto_enable=None):
            # Note that the following doesn't seem to support unicode search_path
            distributions, errors = working_set.find_plugins(
    Severity: Minor
    Found in trac/loader.py - About 5 hrs 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 scan has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

    def scan(lines):
        """Scans template lines and separates Jinja2 structure from HTML structure.
        """
    
        def count_parens(line):
    Severity: Minor
    Found in contrib/jinjachecker.py - About 5 hrs 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

    File cache.py has 389 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    #
    # Copyright (C) 2005-2023 Edgewall Software
    # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
    # All rights reserved.
    Severity: Minor
    Found in trac/versioncontrol/cache.py - About 5 hrs to fix

      File sqlite_backend.py has 388 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      #
      # Copyright (C) 2005-2023 Edgewall Software
      # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
      # All rights reserved.
      Severity: Minor
      Found in trac/db/sqlite_backend.py - About 5 hrs to fix

        Function _render_admin_panel has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

            def _render_admin_panel(self, req, cat, page, component):
                # Detail view?
                if component:
                    comp = model.Component(self.env, component)
                    if req.method == 'POST':
        Severity: Minor
        Found in trac/ticket/admin.py - About 5 hrs 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

        File svn_prop.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        #
        # Copyright (C) 2005-2023 Edgewall Software
        # Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
        # Copyright (C) 2005-2007 Christian Boos <cboos@edgewall.org>
        Severity: Minor
        Found in tracopt/versioncontrol/svn/svn_prop.py - About 5 hrs to fix

          Chrome has 39 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Chrome(Component):
              """Web site chrome assembly manager.
          
              Chrome is everything that is not actual page content.
              """
          Severity: Minor
          Found in trac/web/chrome.py - About 5 hrs to fix
            Severity
            Category
            Status
            Source
            Language