renyijiu/alipay_mini

View on GitHub

Showing 5 of 5 total issues

Method get has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def get(trade_no, amount, subject, buyer_id, options = {})
Severity: Minor
Found in lib/alipay_mini/api/trade_create.rb - About 35 mins to fix

    Method get_trade_params has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def get_trade_params(trade_no, amount, subject, buyer_id, options = {})
    Severity: Minor
    Found in lib/alipay_mini/api/trade_create.rb - About 35 mins to fix

      Method trade_create has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def trade_create(trade_no, amount, subject, buyer_id, options = {})
      Severity: Minor
      Found in lib/alipay_mini.rb - About 35 mins to fix

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

            def self.deep_compact(hash)
              return hash unless hash.is_a?(::Hash)
        
              hash.each_with_object({}) do |(k, v), compact_hash|
                if v.is_a?(::Hash)
        Severity: Minor
        Found in lib/alipay_mini/utils.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

        Method format_res has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def format_res(method, res)
                return [false, "Network error"] unless res.is_a?(Net::HTTPSuccess)
        
                res = JSON.parse(res.body)
                method_key = "#{method.split('.').join('_')}_response"
        Severity: Minor
        Found in lib/alipay_mini/request.rb - About 25 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