bayetech/ll_pay

View on GitHub
lib/ll_pay/refund_order.rb

Summary

Maintainability
A
40 mins
Test Coverage

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

    def refund_order(params, options = {})
      LlPay::Utils.check_required_params(params, REFUND_ORDER_PARAMS)
      params = LlPay::Utils.stringify_keys(params)
      options = LlPay::Utils.stringify_keys(options)

Severity: Minor
Found in lib/ll_pay/refund_order.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 refund_order is too high. [21.26/15]
Open

    def refund_order(params, options = {})
      LlPay::Utils.check_required_params(params, REFUND_ORDER_PARAMS)
      params = LlPay::Utils.stringify_keys(params)
      options = LlPay::Utils.stringify_keys(options)

Severity: Minor
Found in lib/ll_pay/refund_order.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

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

    def refund_order_query(params, options = {})
      params = LlPay::Utils.stringify_keys(params)
      options = LlPay::Utils.stringify_keys(options)

      params[:sign_type] = params[:sign_type] || LlPay.sign_type
Severity: Minor
Found in lib/ll_pay/refund_order.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.

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

      sign_params = { oid_partner: params[:oid_partner],
                      sign_type: params[:sign_type],
                      no_refund: params[:no_refund],
                      dt_refund: params[:dt_refund],
                      money_refund: params[:money_refund],
Severity: Minor
Found in lib/ll_pay/refund_order.rb and 1 other location - About 40 mins to fix
lib/ll_pay/service.rb on lines 15..24

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

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/refund_order.rb by rubocop

Missing top-level module documentation comment.
Open

  module RefundOrder
Severity: Minor
Found in lib/ll_pay/refund_order.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/refund_order.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 }

Freeze mutable objects assigned to constants.
Open

    REFUND_ORDER_PARAMS = %w(oid_partner sign_type no_refund dt_refund money_refund no_order dt_order oid_paybill notify_url)
Severity: Minor
Found in lib/ll_pay/refund_order.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

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

    REFUND_ORDER_PARAMS = %w(oid_partner sign_type no_refund dt_refund money_refund no_order dt_order oid_paybill notify_url)
Severity: Minor
Found in lib/ll_pay/refund_order.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)

Line is too long. [125/80]
Open

    REFUND_ORDER_PARAMS = %w(oid_partner sign_type no_refund dt_refund money_refund no_order dt_order oid_paybill notify_url)
Severity: Minor
Found in lib/ll_pay/refund_order.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/refund_order.rb by rubocop

Line is too long. [89/80]
Open

      request(:post, 'https://queryapi.lianlianpay.com/refundquery.htm', params, options)
Severity: Minor
Found in lib/ll_pay/refund_order.rb by rubocop

Freeze mutable objects assigned to constants.
Open

    REFUND_ORDER_QUERY_PARAMS = %w(oid_partner sign_type no_refund dt_refund oid_refundno)
Severity: Minor
Found in lib/ll_pay/refund_order.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. [84/80]
Open

      request(:post, 'https://yintong.com.cn/traderapi/refund.htm', params, options)
Severity: Minor
Found in lib/ll_pay/refund_order.rb by rubocop

Line is too long. [90/80]
Open

    REFUND_ORDER_QUERY_PARAMS = %w(oid_partner sign_type no_refund dt_refund oid_refundno)
Severity: Minor
Found in lib/ll_pay/refund_order.rb by rubocop

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

    REFUND_ORDER_QUERY_PARAMS = %w(oid_partner sign_type no_refund dt_refund oid_refundno)
Severity: Minor
Found in lib/ll_pay/refund_order.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)

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/refund_order.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