scooterw/geogit-ruby

View on GitHub

Showing 5 of 5 total issues

Method prepare_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def prepare_output(commits)
        commits.map { |c|
          {
            id: c.id.to_s,
            message: c.message,
Severity: Minor
Found in lib/geogit/commands/log.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(geogit, repo_path, message, author_name = nil, author_email = nil)
Severity: Minor
Found in lib/geogit/commands/fast_commit.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(geogit, repo_path, path = '', offset = 0, limit = 0)
    Severity: Minor
    Found in lib/geogit/commands/log.rb - About 35 mins to fix

      Method batch_commits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def batch_commits(commits)
            client_details = "client_id=#{GeoGit.github[:client_id]}&client_secret=#{GeoGit.github[:client_secret]}"
      
            [].tap do |batch|
              MultiJson.load(commits).reverse.each_with_index do |commit, i|
      Severity: Minor
      Found in lib/geogit.rb - 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

      Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run
              command = @geogit.command(LogOp.java_class)
      
              command.add_path @path unless @path.empty?
      
      
      Severity: Minor
      Found in lib/geogit/commands/log.rb - 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

      Severity
      Category
      Status
      Source
      Language