nomoon/lunanode

View on GitHub

Showing 37 of 37 total issues

Method clean_params has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def clean_params(params)
      params.each_with_object({}) do |(param, value), acc|
        next if param.nil? || value.nil?
        next unless param.respond_to?(:to_sym) && value.respond_to?(:to_s)
        acc[param.to_sym] = value.to_s
Severity: Minor
Found in lib/lunanode/api.rb - About 55 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

Unused method argument - country.
Open

      def dns2_record_add(zone_id:, name:, data:, ttl:, type:, policy: nil, weight: nil, region: nil, regiongroup: nil, country: nil, continent: nil, global: nil, latitude: nil, longitude: nil, aux: nil, monitor_id: nil, orig_record_id: nil)

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

Unused method argument - latitude.
Open

      def dns2_record_add(zone_id:, name:, data:, ttl:, type:, policy: nil, weight: nil, region: nil, regiongroup: nil, country: nil, continent: nil, global: nil, latitude: nil, longitude: nil, aux: nil, monitor_id: nil, orig_record_id: nil)

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

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/image"
Severity: Minor
Found in lib/lunanode/api_actions/image.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Add an empty line after magic comments.
Open

source "https://rubygems.org"
Severity: Minor
Found in Gemfile by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Do not place comments on the same line as the end keyword.
Open

    end # :reek:NilCheck :reek:ManualDispatch
Severity: Minor
Found in lib/lunanode/api.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/vm"
Severity: Minor
Found in lib/lunanode/api_actions/vm.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency pry should appear before yard.
Open

  spec.add_development_dependency "pry", "~> 0.13.1"
Severity: Minor
Found in lunanode.gemspec by rubocop

Dependencies in the gemspec should be alphabetically sorted.

Example:

# bad
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'

# good
spec.add_dependency 'rspec'
spec.add_dependency 'rubocop'

# good
spec.add_dependency 'rubocop'

spec.add_dependency 'rspec'

# bad
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'

# good
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'

# good
spec.add_development_dependency 'rubocop'

spec.add_development_dependency 'rspec'

# bad
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'

# good
spec.add_runtime_dependency 'rspec'
spec.add_runtime_dependency 'rubocop'

# good
spec.add_runtime_dependency 'rubocop'

spec.add_runtime_dependency 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
spec.add_dependency 'rubocop'
# For tests
spec.add_dependency 'rspec'

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/sshkey"
Severity: Minor
Found in lib/lunanode/api_actions/sshkey.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Do not place comments on the same line as the end keyword.
Open

    end # :reek:FeatureEnvy
Severity: Minor
Found in lib/lunanode/api.rb by rubocop

This cop checks for comments put on the same line as some keywords. These keywords are: begin, class, def, end, module.

Note that some comments (such as :nodoc: and rubocop:disable) are allowed.

Example:

# bad
if condition
  statement
end # end if

# bad
class X # comment
  statement
end

# bad
def x; end # comment

# good
if condition
  statement
end

# good
class X # :nodoc:
  y
end

Add an empty line after magic comments.
Open

require "cgi"
Severity: Minor
Found in lib/lunanode/api_error.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Add an empty line after magic comments.
Open

lib = File.expand_path("../lib", __FILE__)
Severity: Minor
Found in lunanode.gemspec by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/dns"
Severity: Minor
Found in lib/lunanode/api_actions/dns.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Unused method argument - weight.
Open

      def dns2_record_add(zone_id:, name:, data:, ttl:, type:, policy: nil, weight: nil, region: nil, regiongroup: nil, country: nil, continent: nil, global: nil, latitude: nil, longitude: nil, aux: nil, monitor_id: nil, orig_record_id: nil)

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

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/securitygroup"

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Unused method argument - regiongroup.
Open

      def dns2_record_add(zone_id:, name:, data:, ttl:, type:, policy: nil, weight: nil, region: nil, regiongroup: nil, country: nil, continent: nil, global: nil, latitude: nil, longitude: nil, aux: nil, monitor_id: nil, orig_record_id: nil)

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

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/floating"

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/volume"
Severity: Minor
Found in lib/lunanode/api_actions/volume.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/plan"
Severity: Minor
Found in lib/lunanode/api_actions/plan.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Add an empty line after magic comments.
Open

require "lunanode/api_actions/default/lb"
Severity: Minor
Found in lib/lunanode/api_actions/lb.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end
Severity
Category
Status
Source
Language