redmine/redmine

View on GitHub
lib/redmine/scm/adapters/subversion_adapter.rb

Summary

Maintainability
D
1 day
Test Coverage

Method entries has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

        def entries(path=nil, identifier=nil, options={})
          path ||= ''
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
          entries = Entries.new
          cmd = +"#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
Severity: Minor
Found in lib/redmine/scm/adapters/subversion_adapter.rb - 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

Method revisions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
          path ||= ''
          identifier_from = (identifier_from && identifier_from.to_i > 0) ? identifier_from.to_i : "HEAD"
          identifier_to = (identifier_to && identifier_to.to_i > 0) ? identifier_to.to_i : 1
          revisions = Revisions.new
Severity: Minor
Found in lib/redmine/scm/adapters/subversion_adapter.rb - 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

Method revisions has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
          path ||= ''
          identifier_from = (identifier_from && identifier_from.to_i > 0) ? identifier_from.to_i : "HEAD"
          identifier_to = (identifier_to && identifier_to.to_i > 0) ? identifier_to.to_i : 1
          revisions = Revisions.new
Severity: Minor
Found in lib/redmine/scm/adapters/subversion_adapter.rb - About 1 hr to fix

    Method entries has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def entries(path=nil, identifier=nil, options={})
              path ||= ''
              identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
              entries = Entries.new
              cmd = +"#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
    Severity: Minor
    Found in lib/redmine/scm/adapters/subversion_adapter.rb - About 1 hr to fix

      Method info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def info
                cmd = +"#{self.class.sq_bin} info --xml #{target}"
                cmd << credentials_string
                info = nil
                shellout(cmd) do |io|
      Severity: Minor
      Found in lib/redmine/scm/adapters/subversion_adapter.rb - About 1 hr 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

      Method info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def info
                cmd = +"#{self.class.sq_bin} info --xml #{target}"
                cmd << credentials_string
                info = nil
                shellout(cmd) do |io|
      Severity: Minor
      Found in lib/redmine/scm/adapters/subversion_adapter.rb - About 1 hr to fix

        Method annotate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def annotate(path, identifier=nil)
                  identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
                  cmd = +"#{self.class.sq_bin} blame #{target(path)}@#{identifier}"
                  cmd << credentials_string
                  blame = Annotate.new
        Severity: Minor
        Found in lib/redmine/scm/adapters/subversion_adapter.rb - 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

        Method properties has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def properties(path, identifier=nil)
                  # proplist xml output supported in svn 1.5.0 and higher
                  return nil unless self.class.client_version_above?([1, 5, 0])
        
                  identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
        Severity: Minor
        Found in lib/redmine/scm/adapters/subversion_adapter.rb - About 45 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

        Method diff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def diff(path, identifier_from, identifier_to=nil)
                  path ||= ''
                  identifier_from = (identifier_from and identifier_from.to_i > 0) ? identifier_from.to_i : ''
        
                  identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : (identifier_from.to_i - 1)
        Severity: Minor
        Found in lib/redmine/scm/adapters/subversion_adapter.rb - 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                class << self
                  def client_command
                    @@bin    ||= SVN_BIN
                  end
        
        
        Severity: Major
        Found in lib/redmine/scm/adapters/subversion_adapter.rb and 1 other location - About 1 hr to fix
        lib/redmine/scm/adapters/cvs_adapter.rb on lines 30..55

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 58.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    io.each_line do |line|
                      next unless line =~ %r{^\s*(\d+)\s*(\S+)\s(.*)$}
        
                      rev = $1
                      blame.add_line(
        Severity: Minor
        Found in lib/redmine/scm/adapters/subversion_adapter.rb and 1 other location - About 15 mins to fix
        lib/redmine/scm/adapters/bazaar_adapter.rb on lines 239..250

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 26.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status