poise/poise-boiler

View on GitHub
lib/poise_boiler/helpers/rake/check.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method display_commits has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        def display_commits(commits, summary: false)
          unpushed_count = commits.inject(0) {|memo, (_, pushed)| memo + (pushed ? 0 : 1) }
          shell.say("#{commits.size} commit#{commits.size > 1 ? 's' : ''} #{unpushed_count > 0 ? "(#{unpushed_count} unpushed) " : ''}since #{commits.first[2].name}", unpushed_count > 0 ? :red : :yellow)
          return if summary
          commits.each do |commit, pushed|
Severity: Minor
Found in lib/poise_boiler/helpers/rake/check.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 install has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        def install
          # Delayed so that Rake doesn't need to be loaded to run this file.
          extend ::Rake::DSL

          desc 'Check for unreleased commits'
Severity: Minor
Found in lib/poise_boiler/helpers/rake/check.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 check_project has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def check_project(path, header: nil, summary: false)
          git = Git.open(path)
          # Some checks for repos that aren't full projects.
          return unless git.branches['master']
          return unless git.remote('origin').url
Severity: Minor
Found in lib/poise_boiler/helpers/rake/check.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 check_commits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def check_commits(git)
          # Find either the latest tag (release) or the first commit in the repo.
          last_release = if git.tags.empty?
            git.log.last
          else
Severity: Minor
Found in lib/poise_boiler/helpers/rake/check.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 display_changed_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def display_changed_files(changed, summary: false)
          shell.say("#{changed.size} file#{changed.size > 1 ? 's' : ''} with pending changes", :yellow)
          return if summary
          changed.each do |file|
            color = if file.type == 'A' || file.untracked
Severity: Minor
Found in lib/poise_boiler/helpers/rake/check.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

There are no issues that match your filters.

Category
Status