edgewall/trac

View on GitHub
tracopt/versioncontrol/svn/svn_prop.py

Summary

Maintainability
F
3 days
Test Coverage

Function render_property has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    def render_property(self, name, mode, context, props):
        """Parse svn:mergeinfo and svnmerge-* properties, converting branch
        names to links and providing links to the revision log for merged
        and eligible revisions.
        """
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_prop.py - About 6 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_externals has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def _render_externals(self, prop):
        if not self._externals_map:
            for dummykey, value in self.svn_externals_section.options():
                value = value.split()
                if len(value) != 2:
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_prop.py - About 6 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

File svn_prop.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2023 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2005-2007 Christian Boos <cboos@edgewall.org>
Severity: Minor
Found in tracopt/versioncontrol/svn/svn_prop.py - About 5 hrs to fix

    Function render_property_diff has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        def render_property_diff(self, name, old_context, old_props,
                                 new_context, new_props, options):
            # Build 5 columns table showing modifications on merge sources
            # || source || added || removed || added (ni) || removed (ni) ||
            # || source || removed                                        ||
    Severity: Minor
    Found in tracopt/versioncontrol/svn/svn_prop.py - About 5 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_property_diff has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def render_property_diff(self, name, old_context, old_props,
    Severity: Minor
    Found in tracopt/versioncontrol/svn/svn_prop.py - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if added or removed:
                      if new_spath:
                          status = _(" (added)")
                      else:
                          status = None
      Severity: Major
      Found in tracopt/versioncontrol/svn/svn_prop.py - About 40 mins to fix

        Function _get_revs_link has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _get_revs_link(label, context, spath, revs, title=None):
        Severity: Minor
        Found in tracopt/versioncontrol/svn/svn_prop.py - About 35 mins to fix

          Function _get_blocked_revs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def _get_blocked_revs(props, name, path):
              """Return the revisions blocked from merging for the given property
              name and path.
              """
              if name == 'svnmerge-integrated':
          Severity: Minor
          Found in tracopt/versioncontrol/svn/svn_prop.py - About 35 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