zold-io/wts.zold.io

View on GitHub

Showing 47 of 62 total issues

Avoid too many return statements within this method.
Open

  return true if settings.config['kyc'].include?(login)
Severity: Major
Found in wts.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

      return true if settings.config['kyc'].include?(login)
    Severity: Major
    Found in wts.rb - About 30 mins to fix

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

      def features(*list)
        return if @locals[:guser] && vip?
        list.each do |f|
          next unless settings.toggles.get("stop:#{f}", 'no') == 'yes'
          raise WTS::UserError, "E177: This feature \"#{f}\" is temporarily disabled, sorry"
      Severity: Minor
      Found in wts.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

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

      def country(ip = request.ip)
        settings.zache.get("ip_to_country:#{ip}") do
          geo = Geoplugin.new(request.ip, ssl: true, key: settings.config['geoplugin_token'])
          geo.nil? ? '??' : geo.countrycode
        rescue StandardError
      Severity: Minor
      Found in wts.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

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

        def acquire(login = nil)
          row = if login.nil?
            @pgsql.exec(
              [
                'SELECT address FROM asset',
      Severity: Minor
      Found in objects/assets.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

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

      def parsed_amount
        raise WTS::UserError, 'E110: Parameter "amount" is not provided' if params[:amount].nil?
        param = params[:amount]
        amount = if /^[0-9]+z$/.match?(param)
          Zold::Amount.new(zents: param.to_i)
      Severity: Minor
      Found in front/front_pay.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

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

        def reconcile
          done = 0
          errors = 0
          all(show_empty: true).each do |a|
            after = @sibit.balance(a[:address])
      Severity: Minor
      Found in objects/assets.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