poise/poise-boiler

View on GitHub

Showing 20 of 20 total issues

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 19 (exceeds 5 allowed). Consider refactoring.
Open

      def install
        require 'rspec'
        require 'rspec/its'
        require 'simplecov'
        require 'pry'
Severity: Minor
Found in lib/poise_boiler/helpers/spec_helper.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 17 (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

          # Set the default task.
Severity: Minor
Found in lib/poise_boiler/helpers/rake/core.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 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

          file 'test/docker/docker.key' do
Severity: Minor
Found in lib/poise_boiler/helpers/rake/travis.rb - About 1 hr to fix

    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 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
    
              file 'test/docker/docker.key' do
    Severity: Minor
    Found in lib/poise_boiler/helpers/rake/travis.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 install has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def install
            require 'rspec'
            require 'rspec/its'
            require 'simplecov'
            require 'pry'
    Severity: Minor
    Found in lib/poise_boiler/helpers/spec_helper.rb - About 1 hr to fix

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

              def convert_halite_cookbooks(dest)
                @real_cookbook_deps = {}
                gems_to_convert = {'poise-profiler' => Halite::Gem.new('poise-profiler')}
                gems_to_check = [poise_helper_instance.cookbook]
                # Only look at dev dependcies of the top-level spec, which happens to
      Severity: Minor
      Found in lib/poise_boiler/helpers/kitchen/provisioner_helpers.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 detect_github has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def detect_github
                git_head = git_shell_out(%w{name-rev --name-only HEAD})
                return nil unless git_head
                git_remote = git_shell_out(%W{config --get branch.#{git_head}.remote})
                git_remote = 'origin' if !git_remote || git_remote.empty? # Default value
      Severity: Minor
      Found in lib/poise_boiler/helpers/rake/badges.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 tag_release! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def tag_release!(commit: true, &block)
                # I can't use the gemspec because we might have changed the version.
                current_version = find_current_version
                unless current_version
                  raise "Unable to find current version of #{gem_name}"
      Severity: Minor
      Found in lib/poise_boiler/helpers/rake/release.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 generate_badges has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

              def generate_badges
                # Example badges
                # [![Build Status](https://img.shields.io/travis/poise/poise.svg)](https://travis-ci.org/poise/poise)
                # [![Gem Version](https://img.shields.io/gem/v/poise.svg)](https://rubygems.org/gems/poise)
                # [![Cookbook Version](https://img.shields.io/cookbook/v/poise.svg)](https://supermarket.chef.io/cookbooks/poise)
      Severity: Minor
      Found in lib/poise_boiler/helpers/rake/badges.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 install has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def install
                # Delayed so that Rake doesn't need to be loaded to run this file.
                extend ::Rake::DSL
      
                # Rename the original release task.
      Severity: Minor
      Found in lib/poise_boiler/helpers/rake/release.rb - About 1 hr to fix

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

              def provisioner_config
                {
                  'log_level' => (ENV['DEBUG'] ? 'debug' : (ENV['CHEF_LOG_LEVEL'] || 'auto')),
                  # Use the poise_solo provisioner, also part of kitchen-docker.
                  'name' => 'poise_solo',
        Severity: Minor
        Found in lib/poise_boiler/helpers/kitchen.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 update_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def update_file(path, year)
                  st = File.stat(path)
                  # Skip weird files, things over 1MB.
                  return unless st.file? && st.size < 1024 * 1024
                  fd = File.new(path, mode: 'r+b')
        Severity: Minor
        Found in lib/poise_boiler/helpers/rake/year.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 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

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

                def bump_version!(type: :patch, release: false, &block)
                  version_rb_path = find_version_rb
                  raise "Unable to find a version.rb in #{base}" unless version_rb_path
                  shell.say("Bumping version in #{version_rb_path}") if ENV['DEBUG']
                  content = IO.read(version_rb_path)
        Severity: Minor
        Found in lib/poise_boiler/helpers/rake/bump.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

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

              def windows_platform_config(name)
                {
                  'driver' => ec2_driver_config.merge({
                    'instance_type' => 'm3.medium',
                    'retryable_tries' => 120,
        Severity: Minor
        Found in lib/poise_boiler/helpers/kitchen.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 platform_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def platform_config(name)
                {
                  'name' => name,
                  # On CI enable poise-profiler automatically. Load it here in case the
                  # user defines their own suites.
        Severity: Minor
        Found in lib/poise_boiler/helpers/kitchen.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