bitpay/spree-bitpay

View on GitHub

Showing 3 of 3 total issues

Function init has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        init: function (options) {

            var defaults = {
                top: 'auto',
                autoOpen: false,
Severity: Major
Found in app/assets/javascripts/easyModal.js-master/jquery.easyModal.js - About 4 hrs to fix

    Method process_invoice has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_invoice (status, exception_status = nil)
          case status
          when 'new'
            started_processing
          when 'paid'
    Severity: Minor
    Found in app/models/payment_decorator.rb - About 1 hr 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

    Method validate_bitpay_payment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_bitpay_payment
          states = payments.map(&:state)
          payments.each do |payment|
            payment.failure if payment.state == 'processing'
          end if (states.include?('checkout') && states.include?('processing'))
    Severity: Minor
    Found in app/models/order_decorator.rb - About 35 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

    Severity
    Category
    Status
    Source
    Language