bloomberg/zookeeper-cookbook

View on GitHub

Showing 7 of 7 total issues

Method action_enable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def action_enable
        notifying_block do
          package new_resource.package_name do
            version new_resource.version unless new_resource.version.nil?
            only_if { new_resource.install_method == 'package' }
Severity: Minor
Found in libraries/zookeeper_service.rb - About 1 hr to fix

    Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
    Open

              'electionPort' => election_port).map { |kv| kv.join('=') }.concat(servers).join("\n")
    Severity: Minor
    Found in libraries/zookeeper_config.rb by rubocop

    This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

    When using the symmetrical (default) style:

    If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

    If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.

    When using the new_line style:

    The closing brace of a multi-line method call must be on the line after the last argument of the call.

    When using the same_line style:

    The closing brace of a multi-line method call must be on the same line as the last argument of the call.

    Example:

    # symmetrical: bad
      # new_line: good
      # same_line: bad
      foo(a,
        b
      )
    
      # symmetrical: bad
      # new_line: bad
      # same_line: good
      foo(
        a,
        b)
    
      # symmetrical: good
      # new_line: bad
      # same_line: good
      foo(a,
        b)
    
      # symmetrical: good
      # new_line: good
      # same_line: bad
      foo(
        a,
        b
      )

    Ensure issues_url is set in metadata
    Open

    name 'zookeeper-cluster'
    Severity: Minor
    Found in metadata.rb by foodcritic

    This warning is shown if a cookbook does not include the issues_url property in its metadata file. issues_url is used to point to the location for submitting issues (bugs) for the cookbook and is currently parsed by Supermarket to add links to community cookbooks. Note: issues_url is a Chef 12 only feature that will cause cookbook failures in Chef 11 so it should be properly gated if the code will be run on Chef 11 hosts.

    Ensure source_url is set in metadata
    Open

    name 'zookeeper-cluster'
    Severity: Minor
    Found in metadata.rb by foodcritic

    This warning is shown if a cookbook does not include the source_url property in its metadata file. source_url is used to point to the source location for the cookbook and is currently parsed by Supermarket to add links to community cookbooks. Note: source_url is a Chef 12 only feature that will cause cookbook failures in Chef 11 so it should be properly gated if the code will be run on Chef 11 hosts.

    Favor format over String#%.
    Open

                remote_url new_resource.binary_url % { version: new_resource.version }
    Severity: Minor
    Found in libraries/zookeeper_service.rb by rubocop

    This cop enforces the use of a single string formatting utility. Valid options include Kernel#format, Kernel#sprintf and String#%.

    The detection of String#% cannot be implemented in a reliable manner for all cases, so only two scenarios are considered - if the first argument is a string literal and if the second argument is an array literal.

    Example: EnforcedStyle: format(default)

    # bad
    puts sprintf('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts format('%10s', 'hoge')

    Example: EnforcedStyle: sprintf

    # bad
    puts format('%10s', 'hoge')
    puts '%10s' % 'hoge'
    
    # good
    puts sprintf('%10s', 'hoge')

    Example: EnforcedStyle: percent

    # bad
    puts format('%10s', 'hoge')
    puts sprintf('%10s', 'hoge')
    
    # good
    puts '%10s' % 'hoge'

    Prefer annotated tokens (like %<foo>s</foo>) over template tokens (like %{foo}).
    Open

    default['zookeeper-cluster']['service']['binary_url'] = "http://mirror.cc.columbia.edu/pub/software/apache/zookeeper/zookeeper-%{version}/zookeeper-%{version}.tar.gz" # rubocop:disable Style/StringLiterals
    Severity: Minor
    Found in attributes/default.rb by rubocop

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>

    Prefer annotated tokens (like %<foo>s</foo>) over template tokens (like %{foo}).
    Open

    default['zookeeper-cluster']['service']['binary_url'] = "http://mirror.cc.columbia.edu/pub/software/apache/zookeeper/zookeeper-%{version}/zookeeper-%{version}.tar.gz" # rubocop:disable Style/StringLiterals
    Severity: Minor
    Found in attributes/default.rb by rubocop

    Use a consistent style for named format string tokens.

    Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

    Example: EnforcedStyle: annotated (default)

    # bad
    format('%{greeting}', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%<greeting>s', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: template

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%s', 'Hello')
    
    # good
    format('%{greeting}', greeting: 'Hello')</greeting>

    Example: EnforcedStyle: unannotated

    # bad
    format('%<greeting>s', greeting: 'Hello')
    format('%{greeting}', 'Hello')
    
    # good
    format('%s', 'Hello')</greeting>
    Severity
    Category
    Status
    Source
    Language