Method pull
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pull(id = @item.id)
if @user.fake?
@log.info("It is a fake user with wallet ID #{id}, won't PULL from the network")
remove
rsa = OpenSSL::PKey::RSA.new(2048)
Method pay
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pay(keygap, bnf, amount, details)
raise WTS::UserError, 'E187: Payment amount can\'t be zero' if amount.zero?
raise WTS::UserError, 'E188: Payment amount can\'t be negative' if amount.negative?
raise "The user #{@user.login} is not registered yet" unless @item.exists?
raise "The account #{@user.login} is not confirmed yet" unless @user.confirmed?
Method pay
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def pay(keygap, bnf, amount, details)
raise WTS::UserError, 'E187: Payment amount can\'t be zero' if amount.zero?
raise WTS::UserError, 'E188: Payment amount can\'t be negative' if amount.negative?
raise "The user #{@user.login} is not registered yet" unless @item.exists?
raise "The account #{@user.login} is not confirmed yet" unless @user.confirmed?
- Read upRead up
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 pay_taxes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pay_taxes(keygap)
raise "The user #{@user.login} is not registered yet" unless @item.exists?
raise "The account #{@user.login} is not confirmed yet" unless @user.confirmed?
if @user.fake?
@log.info('It is a fake user, won\'t pay taxes')
Method pay_taxes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pay_taxes(keygap)
raise "The user #{@user.login} is not registered yet" unless @item.exists?
raise "The account #{@user.login} is not confirmed yet" unless @user.confirmed?
if @user.fake?
@log.info('It is a fake user, won\'t pay taxes')
- Read upRead up
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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(item, user, wallets, remotes, copies, log: Zold::Log::NULL, network: 'test')
Method push
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def push
if @user.fake?
@log.info('It is a fake user, won\'t PUSH to the network')
return
end
- Read upRead up
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"