edgewall/trac

View on GitHub

Showing 1,050 of 1,372 total issues

Function wikisyntax_test_suite has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def wikisyntax_test_suite(data=None, setup=None, file=None, teardown=None,
                          context=None, default_data=False,
                          enable_components=None, disable_components=None,
                          env_path=None, destroying=False):
    suite = unittest.TestSuite()
Severity: Minor
Found in trac/wiki/test.py - About 4 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 daemonize has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def daemonize(pidfile=None, progname=None, stdin='/dev/null',
              stdout='/dev/null', stderr='/dev/null', umask=0o22):
    """Fork a daemon process."""
    if pidfile:
        # Check whether the pid file already exists and refers to a still
Severity: Minor
Found in trac/util/daemon.py - About 4 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 copytree has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def copytree(src, dst, symlinks=False, skip=[], overwrite=False):
    """Recursively copy a directory tree using copy2() (from shutil.copytree.)

    Added a `skip` parameter consisting of absolute paths
    which we don't want to copy.
Severity: Minor
Found in trac/util/__init__.py - About 4 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_cnx has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def get_cnx(self, connector, kwargs, timeout=None):
        cnx = None
        log = kwargs.get('log')
        key = str(kwargs)
        start = time_now()
Severity: Minor
Found in trac/db/pool.py - About 4 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 convert_content has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_content(self, req, mimetype, content, key, filename=None,
                        url=None, iterable=False):
        """Convert the given content to the target MIME type represented by
        `key`, which can be either a MIME type or a key. Returns a tuple of
        (content, output_mime_type, extension)."""
Severity: Minor
Found in trac/mimeview/api.py - About 4 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 execute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(self, req=None, cached_ids=None, authname=None, href=None):
        """Retrieve the list of matching tickets.
        """
        if req is not None:
            href = req.href
Severity: Minor
Found in trac/ticket/query.py - About 4 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 expand_macro has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def expand_macro(self, formatter, name, content, args=None):
        if content is not None:
            content = content.strip()
        if not args and not content:
            raw_actions = self.config.options('ticket-workflow')
Severity: Minor
Found in trac/ticket/default_workflow.py - About 4 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 convertDiff has 100 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function convertDiff(name, table, pre) {
    var inline = $(table).hasClass('inline');
    var ths = table.tHead.rows[0].cells;
    var afile, bfile;
    if ( inline ) {
Severity: Major
Found in trac/htdocs/js/diff.js - About 4 hrs to fix

    Function _set_list_depth has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def _set_list_depth(self, depth, new_type=None, lclass=None, start=None):
            def open_list():
                self.close_table()
                self.close_paragraph()
                self.close_indentation() # FIXME: why not lists in quotes?
    Severity: Minor
    Found in trac/wiki/formatter.py - About 3 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_initenv has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_initenv(self, line):
            def initenv_error(msg):
                printerr(_("Initenv for '%(env)s' failed.", env=self.envname),
                         "\n%s" % msg)
            if self.env_check():
    Severity: Minor
    Found in trac/admin/console.py - About 3 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 copy_tables has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def copy_tables(src_env, dst_env, src_db, dst_db, src_dburi, dst_dburi):
        printfout("Copying tables:")
    
        if src_dburi.startswith('sqlite:'):
            src_db.cnx._eager = False  # avoid uses of eagar cursor
    Severity: Minor
    Found in trac/db/convert.py - About 3 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 save has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def save(self):
            """Write the configuration options to the primary file."""
    
            all_options = {}
            for (section, name), option in Option.get_registry().items():
    Severity: Minor
    Found in trac/config.py - About 3 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 save_changes has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def save_changes(self, author=None, comment=None, when=None, replyto=None):
            """
            Store ticket changes in the database. The ticket must already exist in
            the database.  Returns False if there were no changes to save, True
            otherwise.
    Severity: Minor
    Found in trac/ticket/model.py - About 3 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 custom_fields has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def custom_fields(self):
            """Return the list of custom ticket fields available for tickets."""
            fields = TicketFieldList()
            config = self.ticket_custom_section
            for name in [option for option, value in config.options()
    Severity: Minor
    Found in trac/ticket/api.py - About 3 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_ticket_group_stats has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_ticket_group_stats(self, ticket_ids):
            total_cnt = len(ticket_ids)
            all_statuses = set(TicketSystem(self.env).get_all_status())
            status_cnt = {}
            for s in all_statuses:
    Severity: Minor
    Found in trac/ticket/roadmap.py - About 3 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 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        """Merge translated strings from another PO file.
    
        $ src=../trac-1.2-stable/trac/locale/de/LC_MESSAGES
        $ PYTHONPATH=. contrib/%(prog)s messages $src/messages.po [locale]
    Severity: Minor
    Found in contrib/merge_catalog.py - About 3 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

    CachedRepository has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CachedRepository(Repository):
    
        has_linear_changesets = False
    
        scope = property(lambda self: self.repos.scope)
    Severity: Minor
    Found in trac/versioncontrol/cache.py - About 3 hrs to fix

      Function grouped_stats_data has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      def grouped_stats_data(env, stats_provider, tickets, by, per_group_stats_data):
          """Get the `tickets` stats data grouped by ticket field `by`.
      
          `per_group_stats_data(gstat, group_name)` should return a data dict to
          include for the group with field value `group_name`.
      Severity: Minor
      Found in trac/ticket/roadmap.py - About 3 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 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, env, report=None, constraints=None, cols=None,
                       order=None, desc=0, group=None, groupdesc=0, verbose=0,
                       rows=None, page=None, max=None, format=None):
              self.env = env
              self.id = report  # if not None, it's the corresponding saved query
      Severity: Minor
      Found in trac/ticket/query.py - About 3 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 _make_lhref_link has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def _make_lhref_link(self, match, fullmatch, rel, ns, target, label):
              if not label: # e.g. `[http://target]` or `[wiki:target]`
                  if target:
                      if ns and target.startswith('//'):     # for `[http://target]`
                          label = ns + ':' + target   #  use `http://target`
      Severity: Minor
      Found in trac/wiki/formatter.py - About 3 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