edgewall/trac

View on GitHub
trac/wiki/parser.py

Summary

Maintainability
B
4 hrs
Test Coverage

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 _prepare_rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_rules(self):
        from trac.wiki.api import WikiSystem
        if not self._compiled_rules:
            helpers = []
            handlers = {}
Severity: Minor
Found in trac/wiki/parser.py - About 55 mins 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

Avoid deeply nested control flow statements.
Open

                    if len(flag) > 1:
                        keys.append(str(flag[1:]))
                        values.append(False)
                else:
Severity: Major
Found in trac/wiki/parser.py - About 45 mins to fix

    Function link_resolvers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def link_resolvers(self):
            if not self._link_resolvers:
                from trac.wiki.api import WikiSystem
                resolvers = {}
                for resolver in WikiSystem(self.env).syntax_providers:
    Severity: Minor
    Found in trac/wiki/parser.py - About 25 mins 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

    There are no issues that match your filters.

    Category
    Status