bayetech/ll_pay

View on GitHub
lib/ll_pay/service.rb

Summary

Maintainability
A
40 mins
Test Coverage

Method has too many lines. [17/10]
Open

    def securitypay_pay_json(params, options = {})
      LlPay::Utils.check_required_params(params, SECURITY_PAY_REQUIRED_PARAMS)
      params = LlPay::Utils.stringify_keys(params)
      options = LlPay::Utils.stringify_keys(options)

Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for securitypay_pay_json is too high. [21.26/15]
Open

    def securitypay_pay_json(params, options = {})
      LlPay::Utils.check_required_params(params, SECURITY_PAY_REQUIRED_PARAMS)
      params = LlPay::Utils.stringify_keys(params)
      options = LlPay::Utils.stringify_keys(options)

Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      sign_params = { busi_partner: params[:busi_partner],
                      dt_order: params[:dt_order],
                      money_order: params[:money_order],
                      no_order: params[:no_order],
                      notify_url: params[:notify_url],
Severity: Minor
Found in lib/ll_pay/service.rb and 1 other location - About 40 mins to fix
lib/ll_pay/refund_order.rb on lines 12..21

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Extra empty line detected at module body beginning.
Open


    SECURITY_PAY_REQUIRED_PARAMS = %w(busi_partner dt_order info_order money_order name_goods no_order notify_url oid_partner risk_item sign_type valid_order)
Severity: Minor
Found in lib/ll_pay/service.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

Line is too long. [158/80]
Open

    SECURITY_PAY_REQUIRED_PARAMS = %w(busi_partner dt_order info_order money_order name_goods no_order notify_url oid_partner risk_item sign_type valid_order)
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

Line is too long. [87/80]
Open

      params[:sign_type] = params[:sign_type] || options[:sign_type] || LlPay.sign_type
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

Freeze mutable objects assigned to constants.
Open

    SECURITY_PAY_REQUIRED_PARAMS = %w(busi_partner dt_order info_order money_order name_goods no_order notify_url oid_partner risk_item sign_type valid_order)
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Line is too long. [95/80]
Open

      params[:oid_partner] = params[:oid_partner] || options[:oid_partner] || LlPay.oid_partner
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

%w-literals should be delimited by [ and ].
Open

    SECURITY_PAY_REQUIRED_PARAMS = %w(busi_partner dt_order info_order money_order name_goods no_order notify_url oid_partner risk_item sign_type valid_order)
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Missing top-level module documentation comment.
Open

  module Service
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Closing hash brace must be on the same line as the last hash element when opening brace is on the same line as the first hash element.
Open

                    }
Severity: Minor
Found in lib/ll_pay/service.rb by rubocop

This cop checks that the closing brace in a hash literal is either on the same line as the last hash element, or a new line.

When using the symmetrical (default) style:

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

If a hash's opening brace is on the line above the first element of the hash, then the closing brace should be on the line below the last element of the hash.

When using the new_line style:

The closing brace of a multi-line hash literal must be on the line after the last element of the hash.

When using the same_line style:

The closing brace of a multi-line hash literal must be on the same line as the last element of the hash.

Example: EnforcedStyle: symmetrical (default)

# bad
  { a: 1,
    b: 2
  }
  # bad
  {
    a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2 }

  # good
  {
    a: 1,
    b: 2
  }

Example: EnforcedStyle: new_line

# bad
  {
    a: 1,
    b: 2 }

  # bad
  { a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2
  }

  # good
  {
    a: 1,
    b: 2
  }

Example: EnforcedStyle: same_line

# bad
  { a: 1,
    b: 2
  }

  # bad
  {
    a: 1,
    b: 2
  }

  # good
  {
    a: 1,
    b: 2 }

  # good
  { a: 1,
    b: 2 }

There are no issues that match your filters.

Category
Status