myfreecomm/billimatic-client-ruby

View on GitHub
lib/billimatic/request.rb

Summary

Maintainability
A
0 mins
Test Coverage

Billimatic::Request has no descriptive comment
Open

  class Request
Severity: Minor
Found in lib/billimatic/request.rb by reek

Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

Example

Given

class Dummy
  # Do things...
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [1]:Dummy has no descriptive comment (IrresponsibleModule)

Fixing this is simple - just an explaining comment:

# The Dummy class is responsible for ...
class Dummy
  # Do things...
end

Billimatic::Request#options performs a nil-check
Open

        }.reject {|k,v| v.nil?}
Severity: Minor
Found in lib/billimatic/request.rb by reek

A NilCheck is a type check. Failures of NilCheck violate the "tell, don't ask" principle.

Additionally, type checks often mask bigger problems in your source code like not using OOP and / or polymorphism when you should.

Example

Given

class Klass
  def nil_checker(argument)
    if argument.nil?
      puts "argument isn't nil!"
    end
  end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [3]:Klass#nil_checker performs a nil-check. (NilCheck)

Billimatic::Request#options has the variable name 'v'
Open

        }.reject {|k,v| v.nil?}
Severity: Minor
Found in lib/billimatic/request.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Billimatic::Request#options has the variable name 'k'
Open

        }.reject {|k,v| v.nil?}
Severity: Minor
Found in lib/billimatic/request.rb by reek

An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

Unused block argument - k. If it's necessary, use _ or _k as an argument name to indicate that it won't be used.
Open

        }.reject {|k,v| v.nil?}
Severity: Minor
Found in lib/billimatic/request.rb by rubocop

This cop checks for unused block arguments.

Example:

# bad

do_something do |used, unused|
  puts used
end

do_something do |bar|
  puts :foo
end

define_method(:foo) do |bar|
  puts :baz
end

Example:

#good

do_something do |used, _unused|
  puts used
end

do_something do
  puts :foo
end

define_method(:foo) do |_bar|
  puts :baz
end

There are no issues that match your filters.

Category
Status