johnbellone/chef-updater-cookbook

View on GitHub

Showing 11 of 11 total issues

Method fancy_extension has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

      def fancy_extension
        arch = node['kernel']['machine']
        if platform_family?('rhel')
          identifier = "el#{node['platform_version'].to_i}"
          "#{identifier}.#{arch}.rpm"
Severity: Minor
Found in libraries/chef_updater.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 action_run has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def action_run
        requested_package_version = new_resource.package_version.split('-').first
        return if chef_version.satisfies?(">= #{requested_package_version}")
        notifying_block do
          location = remote_file new_resource.fancy_basename do
Severity: Minor
Found in libraries/chef_updater.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 action_run has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def action_run
        requested_package_version = new_resource.package_version.split('-').first
        return if chef_version.satisfies?(">= #{requested_package_version}")
        notifying_block do
          location = remote_file new_resource.fancy_basename do
Severity: Minor
Found in libraries/chef_updater.rb - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

              return '2012r2'
    Severity: Major
    Found in libraries/chef_updater.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                return platform_version
      Severity: Major
      Found in libraries/chef_updater.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                  return platform_version
        Severity: Major
        Found in libraries/chef_updater.rb - About 30 mins to fix

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

                def fancy_path
                  platform = platform_family?('rhel') ? 'el' : node['platform']
                  url_version = get_url_version(platform, node['platform_version'])
                  major   = package_version.split('.')[0].to_i
                  minor   = package_version.split('.')[1].to_i
          Severity: Minor
          Found in libraries/chef_updater.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

          Do not use spaces inside percent literal delimiters.
          Open

                              %W[ #{platform} #{url_version} ]
          Severity: Minor
          Found in libraries/chef_updater.rb by rubocop

          Checks for unnecessary additional spaces inside the delimiters of %i/%w/%x literals.

          Example:

          # good
          %i(foo bar baz)
          
          # bad
          %w( foo bar baz )
          
          # bad
          %x(  ls -l )

          Do not use spaces inside percent literal delimiters.
          Open

                              %W[ #{version} #{platform} #{url_version} ]
          Severity: Minor
          Found in libraries/chef_updater.rb by rubocop

          Checks for unnecessary additional spaces inside the delimiters of %i/%w/%x literals.

          Example:

          # good
          %i(foo bar baz)
          
          # bad
          %w( foo bar baz )
          
          # bad
          %x(  ls -l )

          Do not use spaces inside percent literal delimiters.
          Open

                              %W[ #{platform} #{url_version} ]
          Severity: Minor
          Found in libraries/chef_updater.rb by rubocop

          Checks for unnecessary additional spaces inside the delimiters of %i/%w/%x literals.

          Example:

          # good
          %i(foo bar baz)
          
          # bad
          %w( foo bar baz )
          
          # bad
          %x(  ls -l )

          Do not use spaces inside percent literal delimiters.
          Open

                              %W[ #{version} #{platform} #{url_version} ]
          Severity: Minor
          Found in libraries/chef_updater.rb by rubocop

          Checks for unnecessary additional spaces inside the delimiters of %i/%w/%x literals.

          Example:

          # good
          %i(foo bar baz)
          
          # bad
          %w( foo bar baz )
          
          # bad
          %x(  ls -l )
          Severity
          Category
          Status
          Source
          Language