IotaSpencer/cloud_party

View on GitHub

Showing 177 of 177 total issues

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

          if @body.fetch(:timing, nil)

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Use %r around regular expression.
Open

        if endpoint =~ /^\/zones\/:id\/dns_records\/import\/?$/

This cop enforces using // or %r around regular expressions.

Example: EnforcedStyle: slashes (default)

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = %r{
  foo
  (bar)
  (baz)
}x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = /
  foo
  (bar)
  (baz)
/x

Example: EnforcedStyle: percent_r

# bad
snake_case = /^[\dA-Z_]+$/

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = %r{^[\dA-Z_]+$}

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: EnforcedStyle: mixed

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: AllowInnerSlashes: false (default)

# If `false`, the cop will always recommend using `%r` if one or more
# slashes are found in the regexp string.

# bad
x =~ /home\//

# good
x =~ %r{home/}

Example: AllowInnerSlashes: true

# good
x =~ /home\//

Replace class var @@zone with a class instance var.
Open

        @@zone = CloudParty::Responses::Zones.new(:get, '/zones', get('/zones', query: @options), @options).result.first.fetch(:id, nil)
Severity: Minor
Found in lib/cloud_party/nodes/zones.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

        CloudParty::Responses::Zones.new(:delete, '/zones/:id', self.class.delete(""))
Severity: Minor
Found in lib/cloud_party/nodes/zones.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Do not use semicolons to terminate expressions.
Open

    hash = value.inject({}){|memo,(k,v)| memo[k.to_sym] = Hash.transform_keys_to_symbols(v); memo}
Severity: Minor
Found in lib/cloud_party.rb by rubocop

This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.

Example:

# bad
foo = 1; bar = 2;
baz = 3;

# good
foo = 1
bar = 2
baz = 3

2 trailing blank lines detected.
Open

Useless assignment to variable - managed_by_apps.
Open

          managed_by_apps = DateTime.iso8601(hsh.dig(:managed_by_apps))

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Use attr_reader to define trivial reader methods.
Open

    def api_key
Severity: Minor
Found in lib/cloud_party/simple.rb by rubocop

This cop looks for trivial reader/writer methods, that could have been created with the attr_* family of functions automatically.

Example:

# bad
def foo
  @foo
end

def bar=(val)
  @bar = val
end

def self.baz
  @baz
end

# good
attr_reader :foo
attr_writer :bar

class << self
  attr_reader :baz
end

Unused method argument - id. If it's necessary, use _ or _id as an argument name to indicate that it won't be used. You can also write as get(*) if you want the method to accept any arguments but don't care about them.
Open

      def get(id)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Use options[:ttl] = ttl instead of options.merge!(ttl: ttl).
Open

        options.merge!(ttl: ttl) unless ttl.nil?

This cop identifies places where Hash#merge! can be replaced by Hash#[]=.

Example:

hash.merge!(a: 1)
hash.merge!({'key' => 'value'})
hash.merge!(a: 1, b: 2)

Extra empty line detected at module body beginning.
Open


    ##
Severity: Minor
Found in lib/cloud_party/exceptions.rb by rubocop

This cops checks if empty lines around the bodies of modules match the configuration.

Example: EnforcedStyle: empty_lines

# good

module Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

module Foo
  module Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
module Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

module Foo
  def bar
    # ...
  end
end

HACK found
Open

  - HACK
Severity: Minor
Found in .rubocop_config.yml by fixme

TODO found
Open

  Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop_config.yml by fixme

HACK found
Open

  Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop_config.yml by fixme

FIXME found
Open

  Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop_config.yml by fixme

TODO found
Open

  - TODO
Severity: Minor
Found in .rubocop_config.yml by fixme

FIXME found
Open

  - FIXME
Severity: Minor
Found in .rubocop_config.yml by fixme
Severity
Category
Status
Source
Language