edgewall/trac

View on GitHub

Showing 1,048 of 1,370 total issues

ReportModule has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class ReportModule(Component):

    implements(INavigationContributor, IPermissionRequestor, IRequestHandler,
               IWikiSyntaxProvider)

Severity: Minor
Found in trac/ticket/report.py - About 2 hrs to fix

    Function open_environment has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def open_environment(env_path=None, use_cache=False):
        """Open an existing environment object, and verify that the database is up
        to date.
    
        :param env_path: absolute path to the environment directory; if
    Severity: Minor
    Found in trac/env.py - About 2 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_dir has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_dir(self, req, repos, node, rev, order, desc):
            req.perm(node.resource).require('BROWSER_VIEW')
            download_href = self._get_download_href
    
            # Entries metadata
    Severity: Minor
    Found in trac/versioncontrol/web_ui/browser.py - About 2 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_all_repositories has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_all_repositories(self):
            """Return a dictionary of repository information, indexed by name."""
            if not self._all_repositories:
                all_repositories = {}
                for provider in self.providers:
    Severity: Minor
    Found in trac/versioncontrol/api.py - About 2 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_processor_args has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_processor_args(processor_args):
        """Parse a string containing parameter assignments,
        and return the corresponding dictionary.
    
        Isolated keywords are interpreted as `bool` flags, `False` if the keyword
    Severity: Minor
    Found in trac/wiki/parser.py - About 2 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 _table_cell_formatter has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _table_cell_formatter(self, match, fullmatch):
            self.open_table()
            self.open_table_row()
            self.continue_table = 1
            separator = fullmatch.group('table_cell_sep')
    Severity: Minor
    Found in trac/wiki/formatter.py - About 2 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 is_safe_origin has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_safe_origin(safe_origins, uri, req=None):
        """Whether the given uri is a safe cross-origin."""
        if not uri or ':' not in uri and not uri.startswith('//'):
            return True
        if any(safe == '*' for safe in safe_origins):
    Severity: Minor
    Found in trac/util/html.py - About 2 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_doc has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def print_doc(cls, docs, stream=None, short=False, long=False):
            if stream is None:
                stream = sys.stdout
            docs = [doc for doc in docs if doc[2]]
            if not docs:
    Severity: Minor
    Found in trac/admin/console.py - About 2 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 _do_send has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _do_send(self, transport, event, message, cc_addrs, bcc_addrs):
            notify_sys = NotificationSystem(self.env)
            smtp_from = notify_sys.smtp_from
            smtp_from_name = notify_sys.smtp_from_name or self.env.project_name
            smtp_replyto = notify_sys.smtp_replyto
    Severity: Minor
    Found in trac/notification/mail.py - About 2 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 __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, path, log, user=None, password=None, host=None,
                     port=None, params={}):
            if path.startswith('/'):
                path = path[1:]
            if password is None:
    Severity: Minor
    Found in trac/db/mysql_backend.py - About 2 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_actions_and_groups has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_actions_and_groups(self, subjects):
            """Get actions and groups for `subjects`, an iterable of username
            and groups that username is a member of.
            """
            actions = set()
    Severity: Minor
    Found in trac/perm.py - About 2 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_source has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_source(self, context, lines, annotations):
            from trac.web.chrome import add_warning
            annotators, labels, titles = {}, {}, {}
            for annotator in self.annotators:
                atype, alabel, atitle = annotator.get_annotation_type()
    Severity: Minor
    Found in trac/mimeview/api.py - About 2 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 trac_get_reference has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def trac_get_reference(env, context, rawtext, target, text):
            fulltext = target + ' ' + text if text else target
            link = extract_link(env, context, fulltext)
            uri = None
            missing = False
    Severity: Minor
    Found in trac/mimeview/rst.py - About 2 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 _to_users has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _to_users(self, users_perms_and_groups, ticket):
            """Finds all users contained in the list of `users_perms_and_groups`
            by recursive lookup of users when a `group` is encountered.
            """
            ps = PermissionSystem(self.env)
    Severity: Minor
    Found in trac/ticket/default_workflow.py - About 2 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_comment_diff has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _render_comment_diff(self, req, ticket, data, cnum):
            """Show differences between two versions of a ticket comment."""
            req.perm(ticket.resource).require('TICKET_VIEW')
            new_version = req.args.getint('version', 1)
            old_version = req.args.getint('old_version', new_version)
    Severity: Minor
    Found in trac/ticket/web_ui.py - About 2 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 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_request(self, req):
            milestone_id = req.args.get('id')
            action = req.args.get('action', 'view')
            if not milestone_id and action == 'view':
                req.redirect(req.href.roadmap())
    Severity: Minor
    Found in trac/ticket/roadmap.py - About 2 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_tags_or_branches has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_tags_or_branches(self, paths):
            """Retrieve known branches or tags."""
            for path in self.params.get(paths, []):
                if path.endswith('*'):
                    folder = posixpath.dirname(path)
    Severity: Minor
    Found in tracopt/versioncontrol/svn/svn_fs.py - About 2 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_copy_ancestry has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_copy_ancestry(self):
            """Retrieve the list of `(path,rev)` copy ancestors of this node.
            Most recent ancestor first. Each ancestor `(path, rev)` corresponds
            to the path and revision of the source at the time the copy or move
            operation was performed.
    Severity: Minor
    Found in tracopt/versioncontrol/svn/svn_fs.py - About 2 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 __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, repos, path, rev, log, ls_tree_info=None,
                     historian=None):
            self.log = log
            self.repos = repos
            self.fs_sha = None # points to either tree or blobs
    Severity: Minor
    Found in tracopt/versioncontrol/git/git_fs.py - About 2 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

    SQLiteConnection has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SQLiteConnection(ConnectionBase, ConnectionWrapper):
        """Connection wrapper for SQLite."""
    
        __slots__ = ['_active_cursors', '_eager']
    
    
    Severity: Minor
    Found in trac/db/sqlite_backend.py - About 2 hrs to fix
      Severity
      Category
      Status
      Source
      Language