caskdata/hadoop_cookbook

View on GitHub

Showing 831 of 831 total issues

Module has too many lines. [194/100]
Open

  module Helpers
    #
    # Given an HDP version (2.6.1.0), return its build number (129)
    #
    def hdp_build_number(version)
Severity: Minor
Found in libraries/helpers.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [55/10]
Open

    def hdp_version
      case node['hadoop']['distribution_version']
      when '2.2.0.0'
        '2.2.0.0-2041'
      when '2.2.1.0'
Severity: Minor
Found in libraries/helpers.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Block has too many lines. [74/25]
Open

%w(hadoop_env mapred_env yarn_env).each do |envfile|
  %w(hadoop hadoop_mapred yarn).each do |svc|
    # Keep next here, in case envfile isn't set, so we don't NPE on directory resource
    next unless node['hadoop'].key?(envfile) && node['hadoop'][envfile].key?("#{svc}_log_dir")
    # Create directory
Severity: Minor
Found in recipes/default.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Assignment Branch Condition size for check_deprecated_jaas_config is too high. [37.66/15]
Open

    def check_deprecated_jaas_config(service)
      if node[service].key?('jaas')
        %w(client server).each do |key|
          next unless node[service]['jaas'].key?(key) &&
                      node[service]['jaas'][key].key?('usekeytab') &&
Severity: Minor
Found in libraries/helpers.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Cyclomatic complexity for hdp_version is too high. [26/6]
Open

    def hdp_version
      case node['hadoop']['distribution_version']
      when '2.2.0.0'
        '2.2.0.0-2041'
      when '2.2.1.0'
Severity: Minor
Found in libraries/helpers.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Assignment Branch Condition size for check_jaas_config is too high. [34.53/15]
Open

    def check_jaas_config(service)
      %w(client master).each do |type|
        next unless node[service].key?("#{type}_jaas")
        %w(client server).each do |key| # These are JAAS keys, not files
          next unless node[service]["#{type}_jaas"].key?(key) &&
Severity: Minor
Found in libraries/helpers.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

File repo.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

major_platform_version = node['platform_version'].to_i
key = 'RPM-GPG-KEY'

# Ensure apt caches are updated and apt resources available
include_recipe 'apt' if node['platform_family'] == 'debian'
Severity: Minor
Found in recipes/repo.rb - About 3 hrs to fix

    Assignment Branch Condition size for hdp_version is too high. [27.75/15]
    Open

        def hdp_version
          case node['hadoop']['distribution_version']
          when '2.2.0.0'
            '2.2.0.0-2041'
          when '2.2.1.0'
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Block has too many lines. [57/25]
    Open

      %w(hadoop hadoop_mapred yarn).each do |svc|
        # Keep next here, in case envfile isn't set, so we don't NPE on directory resource
        next unless node['hadoop'].key?(envfile) && node['hadoop'][envfile].key?("#{svc}_log_dir")
        # Create directory
        directory node['hadoop'][envfile]["#{svc}_log_dir"] do
    Severity: Minor
    Found in recipes/default.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Assignment Branch Condition size for write_jaas_config is too high. [26.19/15]
    Open

        def write_jaas_config(service)
          # Setup client_jaas.conf master_jaas.conf
          %w(client master).each do |type|
            next unless node[service].key?("#{type}_jaas") &&
                        node[service]["#{type}_jaas"].key?('client')
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for hadoop_config is too high. [26.68/15]
    Open

        def hadoop_config(service, key, property, deprecated_property = nil, default_value = nil)
          if node.key?(service) && node[service].key?(key) && node[service][key].key?(property)
            node[service][key][property]
          elsif node.key?(service) && node[service].key?(key) && node[service][key].key?(deprecated_property)
            node[service][key][deprecated_property]
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [20/10]
    Open

        def hdp_build_number(version)
          repo_path = [
            'http://public-repo-1.hortonworks.com/HDP',
            hdp_repo_os_path,
            '2.x/updates',
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for write_deprecated_jaas_config is too high. [25.2/15]
    Open

        def write_deprecated_jaas_config(service)
          return unless node[service].key?('jaas') &&
                        node[service]['jaas'].key?('client')
          conf_dir = "/etc/#{service}/#{node[service]['conf_dir']}"
          template "#{conf_dir}/jaas.conf" do
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [16/10]
    Open

        def hadoop_package(name)
          return name unless hdp22? || iop?
          return name if node['platform_family'] == 'debian'
          fw =
            if name == 'spark-core'
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [16/10]
    Open

        def write_jaas_config(service)
          # Setup client_jaas.conf master_jaas.conf
          %w(client master).each do |type|
            next unless node[service].key?("#{type}_jaas") &&
                        node[service]["#{type}_jaas"].key?('client')
    Severity: Minor
    Found in libraries/helpers.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method hdp_version has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def hdp_version
          case node['hadoop']['distribution_version']
          when '2.2.0.0'
            '2.2.0.0-2041'
          when '2.2.1.0'
    Severity: Major
    Found in libraries/helpers.rb - About 2 hrs to fix

      Assignment Branch Condition size for hadoop_kerberos? is too high. [19.24/15]
      Open

          def hadoop_kerberos?
            node['hadoop']['core_site'].key?('hadoop.security.authorization') &&
              node['hadoop']['core_site'].key?('hadoop.security.authentication') &&
              node['hadoop']['core_site']['hadoop.security.authorization'].to_s == 'true' &&
              node['hadoop']['core_site']['hadoop.security.authentication'] == 'kerberos'
      Severity: Minor
      Found in libraries/helpers.rb by rubocop

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Method has too many lines. [14/10]
      Open

          def write_deprecated_jaas_config(service)
            return unless node[service].key?('jaas') &&
                          node[service]['jaas'].key?('client')
            conf_dir = "/etc/#{service}/#{node[service]['conf_dir']}"
            template "#{conf_dir}/jaas.conf" do
      Severity: Minor
      Found in libraries/helpers.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method check_jaas_config has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_jaas_config(service)
            %w(client master).each do |type|
              next unless node[service].key?("#{type}_jaas")
              %w(client server).each do |key| # These are JAAS keys, not files
                next unless node[service]["#{type}_jaas"].key?(key) &&
      Severity: Minor
      Found in libraries/helpers.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

      File default.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      include_recipe 'hadoop::repo'
      include_recipe 'hadoop::_hadoop_checkconfig'
      include_recipe 'hadoop::_compression_libs'
      
      package hadoop_package('hadoop-client') do
      Severity: Minor
      Found in recipes/default.rb - About 2 hrs to fix
        Severity
        Category
        Status
        Source
        Language