edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

Function process_request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def process_request(self, req):
        if req.is_xhr and req.method == 'POST' and 'save_prefs' in req.args:
            self._do_save_xhr(req)

        panels, providers = self._get_panels(req)
Severity: Minor
Found in trac/prefs/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 _do_save has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def _do_save(req, panel, form_fields):
    for field in form_fields:
        val = req.args.get(field, '').strip()
        if val:
            if field == 'ui.auto_preview_timeout':
Severity: Minor
Found in trac/prefs/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 from_string has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def from_string(cls, env, string, **kw):
        kw_strs = ['order', 'group', 'page', 'max', 'format']
        kw_arys = ['rows']
        kw_bools = ['desc', 'groupdesc', 'verbose']
        kw_synonyms = {'row': 'rows'}
Severity: Minor
Found in trac/ticket/query.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_newticket_request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def _process_newticket_request(self, req):
        req.perm(self.realm).require('TICKET_CREATE')
        ticket = model.Ticket(self.env)

        plain_fields = True  # support for /newticket?version=0.11 GETs
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 check_permission has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def check_permission(self, action, username, resource, perm):
        if resource: # fine-grained permission check
            if resource.realm == 'wiki': # wiki realm or resource
                if resource.id: # ... it's a resource
                    if action == 'WIKI_VIEW': # (think 'VIEW' here)
Severity: Minor
Found in sample-plugins/permissions/public_wiki_policy.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 main has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv):
    api_files = rst_files = [rst for rst in os.listdir('doc/api')
                             if fnmatch.fnmatch(rst, '*.rst')
                             and rst not in excluded_docs]
    cmd = argv.pop(0)
Severity: Minor
Found in doc/utils/checkapidoc.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

ChangesetModule has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class ChangesetModule(Component):
    """Renderer providing flexible functionality for showing sets of
    differences.

    If the differences shown are coming from a specific changeset,
Severity: Minor
Found in trac/versioncontrol/web_ui/changeset.py - About 2 hrs to fix

    RepositoryManager has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RepositoryManager(Component):
        """Version control system manager."""
    
        implements(IRequestFilter, IResourceManager, IRepositoryProvider,
                   ITemplateProvider)
    Severity: Minor
    Found in trac/versioncontrol/api.py - About 2 hrs to fix

      WikiProcessor has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class WikiProcessor(object):
      
          _code_block_re = re.compile(r'^<div(?:\s+class="([^"]+)")?>(.*)</div>$')
          _block_elem_re = re.compile(r'^\s*<(?:div|table)(?:\s+[^>]+)?>',
                                      re.I | re.M)
      Severity: Minor
      Found in trac/wiki/formatter.py - About 2 hrs to fix

        Function _do_save has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def _do_save(self, req, attachment):
                req.perm(attachment.resource).require('ATTACHMENT_CREATE')
                parent_resource = attachment.resource.parent
        
                if 'cancel' in req.args:
        Severity: Minor
        Found in trac/attachment.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 check_markup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def check_markup(catalog, message):
                """Verify markups in the translation."""
                def to_array(value):
                    if not isinstance(value, (list, tuple)):
                        value = (value,)
        Severity: Minor
        Found in trac/dist.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 run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

                def run(self):
                    mo_files = []
                    js_files = []
        
                    def js_path(dir, locale):
        Severity: Minor
        Found in trac/dist.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 18 (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 subscriptions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def subscriptions(self, event):
                """Return all subscriptions for a given event.
        
                :return: a list of (sid, authenticated, address, transport, format)
                """
        Severity: Minor
        Found in trac/notification/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 get has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, key, default=''):
                """Return the value of the specified option.
        
                Valid default input is a string. Returns a string.
                """
        Severity: Minor
        Found in trac/config.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_action_controls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_action_controls(self, req, ticket_data):
                tickets = [Ticket(self.env, t['id']) for t in ticket_data]
                action_weights = {}
                action_tickets = {}
                for t in tickets:
        Severity: Minor
        Found in trac/ticket/batch.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_search_results has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_search_results(self, req, terms, filters):
                if 'milestone' not in filters:
                    return
                term_regexps = search_to_regexps(terms)
                milestone_realm = Resource(self.realm)
        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 parse_args has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_args(content):
                """Parse macro arguments and translate them to a query string."""
                clauses = [{}]
                argv = []
                kwargs = {}
        Severity: Minor
        Found in trac/ticket/query.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 verifyrev has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def verifyrev(self, rev):
                """verify/lookup given revision object and return a sha id or None
                if lookup failed
                """
        
        
        Severity: Minor
        Found in tracopt/versioncontrol/git/PyGIT.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_changes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_changes(self, old_path, old_rev, new_path, new_rev,
                            ignore_ancestry=0):
                """Determine differences between two arbitrary pairs of paths
                and revisions.
        
        
        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

        Severity
        Category
        Status
        Source
        Language