gerencianet/gn-api-sdk-ruby

View on GitHub

Showing 70 of 70 total issues

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

        headers['partner-token'] = @options[:partner_token]
Severity: Minor
Found in lib/gerencianet/endpoints.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"

Trailing whitespace detected.
Open

        response = 
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Line is too long. [85/80]
Open

        .call(url, json: body, ssl_context: OpenSSL::SSL::SSLContext.new.tap do |ctx|
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Use Hash#key? instead of Hash#has_key?.
Open

      if (@options.has_key?(:pix_cert))
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop (by default) checks for uses of methods Hash#haskey? and Hash#hasvalue? where it enforces Hash#key? and Hash#value? It is configurable to enforce the inverse, using verbose method names also.

Example: EnforcedStyle: short (default)

# bad Hash#haskey? Hash#hasvalue?

# good Hash#key? Hash#value?

Example: EnforcedStyle: verbose

# bad Hash#key? Hash#value?

# good Hash#haskey? Hash#hasvalue?

Use Hash#key? instead of Hash#has_key?.
Open

      if (@options.has_key?(:pix_cert))
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop (by default) checks for uses of methods Hash#haskey? and Hash#hasvalue? where it enforces Hash#key? and Hash#value? It is configurable to enforce the inverse, using verbose method names also.

Example: EnforcedStyle: short (default)

# bad Hash#haskey? Hash#hasvalue?

# good Hash#key? Hash#value?

Example: EnforcedStyle: verbose

# bad Hash#key? Hash#value?

# good Hash#haskey? Hash#hasvalue?

Trailing whitespace detected.
Open

      end     
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Trailing whitespace detected.
Open

        response = 
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Trailing whitespace detected.
Open

     
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Use 2 (not 0) spaces for indenting an expression spanning multiple lines.
Open

        .call(url, json: body, ssl_context: OpenSSL::SSL::SSLContext.new.tap do |ctx|
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop checks the indentation of the method name part in method calls that span more than one line.

Example: EnforcedStyle: aligned

# bad
while myvariable
.b
  # do something
end

# good
while myvariable
      .b
  # do something
end

# good
Thing.a
     .b
     .c

Example: EnforcedStyle: indented

# good
while myvariable
  .b

  # do something
end

Example: EnforcedStyle: indentedrelativeto_receiver

# good
while myvariable
        .a
        .b

  # do something
end

# good
myvariable = Thing
               .a
               .b
               .c

Trailing whitespace detected.
Open

          HTTP 
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Use the return of the conditional for variable assignment and comparison.
Open

      if (@options.has_key?(:pix_cert))
        url = get_url({}, @endpoints[:PIX][:authorize][:route])
      else
        url = get_url({}, @endpoints[:DEFAULT][:authorize][:route])
      end
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Line is too long. [85/80]
Open

        @options[:sandbox] ? @urls[:DEFAULT][:sandbox] : @urls[:DEFAULT][:production]
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

Don't use parentheses around a method call.
Open

      if (@options.has_key?(:pix_cert))
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Don't use parentheses around the condition of an if.
Open

      if (@options.has_key?(:pix_cert))
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Don't use parentheses around the condition of an if.
Open

      if (@options.has_key?(:pix_cert))
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Don't use parentheses around a method call.
Open

      if (@options.has_key?(:pix_cert))
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Always use raise to signal exceptions.
Open

        fail "unable to authenticate"
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cop checks for uses of fail and raise.

Example: EnforcedStyle: only_raise (default)

# The `only_raise` style enforces the sole use of `raise`.
# bad
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

# good
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

Example: EnforcedStyle: only_fail

# The `only_fail` style enforces the sole use of `fail`.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

Example: EnforcedStyle: semantic

# The `semantic` style enforces the use of `fail` to signal an
# exception, then will use `raise` to trigger an offense after
# it has been rescued.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  # Error thrown
rescue Exception
  fail
end

Kernel.fail
Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  raise 'Preferably with descriptive message'
end

explicit_receiver.fail
explicit_receiver.raise

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

  spec.add_development_dependency "rubocop", "~> 0.49.1", ">= 0.49.1"
Severity: Minor
Found in gerencianet.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'

Extra empty line detected at method body end.
Open


    end
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop

This cops checks if empty lines exist around the bodies of methods.

Example:

# good

def foo
  # ...
end

# bad

def bar

  # ...

end

Line is too long. [83/80]
Open

              cert: OpenSSL::X509::Certificate.new(File.read(@options[:pix_cert])),
Severity: Minor
Found in lib/gerencianet/endpoints.rb by rubocop
Severity
Category
Status
Source
Language