edgewall/trac

View on GitHub

Showing 1,048 of 1,370 total issues

Function _tzinfo has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def _tzinfo(self, dt, is_dst=False):
        tzinfo = dt.tzinfo
        if isinstance(tzinfo, LocalTimezone) and tzinfo._offset is not None:
            return tzinfo

Severity: Minor
Found in trac/util/datefmt.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 20 (exceeds 5 allowed). Consider refactoring.
Open

def _run(args):
    if args is None:
        args = sys.argv[1:]
    admin = TracAdmin()
    if args:
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 save has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self):
        authenticated = int(self.authenticated)
        now = int(time_now())
        items = list(self.items())
        if not authenticated and not self._old and not items:
Severity: Minor
Found in trac/web/session.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 _export_rss has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def _export_rss(self, req, ticket):
        changes = []

        for change in self.rendered_changelog_entries(req, ticket):
            changes.append(change)
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 drawEdge has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function drawEdge(ctx, edge) {
    var p = [{x: edge.source.bx + edge.source.bw * 2 / 3,
              y: edge.source.by - 1,
              dx: 0, dy: -1},
             {x: edge.source.bx + edge.source.bw / 3,
Severity: Major
Found in trac/htdocs/js/workflow_graph.js - About 2 hrs to fix

    WikiAdmin has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WikiAdmin(Component):
        """trac-admin command provider for wiki administration."""
    
        implements(IAdminCommandProvider, IEnvironmentSetupParticipant)
    
    
    Severity: Minor
    Found in trac/wiki/admin.py - About 2 hrs to fix

      AttachmentModule has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class AttachmentModule(Component):
      
          implements(IRequestHandler, INavigationContributor, IWikiSyntaxProvider,
                     IResourceManager)
      
      
      Severity: Minor
      Found in trac/attachment.py - About 2 hrs to fix

        TracAdmin has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class TracAdmin(cmd.Cmd):
            intro = ''
            doc_header = 'Trac Admin Console %(version)s\n' \
                         'Available Commands:\n' \
                         % {'version': TRAC_VERSION}
        Severity: Minor
        Found in trac/admin/console.py - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                      if call_stack == -1 and tok == NAME and value in ('def', 'class'):
                          in_def = True
                      elif tok == OP and value == '(':
                          if in_def:
                              # Avoid false positives for declarations such as:
          Severity: Critical
          Found in trac/dist.py - About 2 hrs to fix

            Configuration has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Configuration(object):
                """Thin layer over `ConfigParser` from the Python standard library.
            
                In addition to providing some convenience methods, the class remembers
                the last modification time of the configuration file, and reparses it
            Severity: Minor
            Found in trac/config.py - About 2 hrs to fix

              Ticket has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Ticket(object):
              
                  realm = 'ticket'
              
                  # Fields that must not be modified directly by the user
              Severity: Minor
              Found in trac/ticket/model.py - About 2 hrs to fix

                TicketSystem has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class TicketSystem(Component):
                    implements(IPermissionRequestor, IWikiSyntaxProvider, IResourceManager,
                               ITicketManipulator)
                
                    change_listeners = ExtensionPoint(ITicketChangeListener)
                Severity: Minor
                Found in trac/ticket/api.py - About 2 hrs to fix

                  SubversionRepository has 24 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class SubversionRepository(Repository):
                      """Repository implementation based on the svn.fs API."""
                  
                      has_linear_changesets = True
                  
                  
                  Severity: Minor
                  Found in tracopt/versioncontrol/svn/svn_fs.py - About 2 hrs to fix

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

                    def _parse_date_iso8601(text, tzinfo):
                        match = _ISO_8601_RE.match(text)
                        if match:
                            try:
                                g = match.groups()
                    Severity: Minor
                    Found in trac/util/datefmt.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 ensure_inline has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def ensure_inline(self, text, in_paragraph=True):
                            content_for_span = None
                            interrupt_paragraph = False
                            if isinstance(text, Element):
                                tagname = text.tag.lower()
                    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 stripentities has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def stripentities(text, keepxmlentities=False):
                        """Return a copy of the given text with any character or numeric entities
                        replaced by the equivalent UTF-8 characters.
                    
                        >>> stripentities('1 < 2')
                    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 to_unicode has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def to_unicode(text, charset=None):
                        """Convert input to a `str` object.
                    
                        For a `bytes` object, we'll first try to decode the bytes using the given
                        `charset` encoding (or UTF-8 if none is specified), then we fall back to
                    Severity: Minor
                    Found in trac/util/text.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_console_locale has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def get_console_locale(env=None, lang=None,
                                           categories=('LANGUAGE', 'LC_ALL', 'LC_MESSAGES',
                                                       'LANG')):
                        """Return negotiated locale for console by locale environments and
                        [trac] default_language."""
                    Severity: Minor
                    Found in trac/admin/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_default_ambiwidth has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _get_default_ambiwidth():
                        """Return width of East Asian Ambiguous based on locale environment
                        variables or Windows codepage.
                        """
                    
                    
                    Severity: Minor
                    Found in trac/util/text.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 execute_command has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def execute_command(self, *args):
                            """Execute a command given by a list of arguments."""
                            args = list(args)
                            for provider in self.providers:
                                for cmd in provider.get_admin_commands() or []:
                    Severity: Minor
                    Found in trac/admin/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

                    Severity
                    Category
                    Status
                    Source
                    Language