Showing 16 of 306 total issues
Class Operation
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Operation
MAX_INT64 = 2**63 - 1
TRUST_LINE_FLAGS_MAPPING = {
full: Stellar::TrustLineFlags.authorized_flag,
maintain_liabilities: Stellar::TrustLineFlags.authorized_to_maintain_liabilities_flag,
Class KeyPair
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class KeyPair
module FactoryMethods
def from_seed(seed)
seed_bytes = Util::StrKey.check_decode(:seed, seed)
from_raw_seed seed_bytes
File operation.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "bigdecimal"
module Stellar
class Operation
MAX_INT64 = 2**63 - 1
Method read_challenge_tx
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.read_challenge_tx(server:, challenge_xdr:, **options)
envelope = Stellar::TransactionEnvelope.from_xdr(challenge_xdr, "base64")
transaction = envelope.tx
if transaction.seq_num != 0
- 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 build_challenge_tx
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.build_challenge_tx(server:, client:, domain: nil, timeout: 300, **options)
if domain.blank? && options.key?(:anchor_name)
ActiveSupport::Deprecation.new("next release", "stellar-sdk").warn <<~MSG
SEP-10 v2.0.0 requires usage of service home domain instead of anchor name in the challenge transaction.
Please update your implementation to use `Stellar::SEP10.build_challenge_tx(..., home_domain: 'example.com')`.
Method check_memo_required
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def check_memo_required(tx_envelope)
tx = tx_envelope.tx
if tx.is_a?(Stellar::FeeBumpTransaction)
tx = tx.inner_tx.v1!.tx
- 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 read_challenge_tx
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.read_challenge_tx(server:, challenge_xdr:, **options)
envelope = Stellar::TransactionEnvelope.from_xdr(challenge_xdr, "base64")
transaction = envelope.tx
if transaction.seq_num != 0
Method check_memo_required
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_memo_required(tx_envelope)
tx = tx_envelope.tx
if tx.is_a?(Stellar::FeeBumpTransaction)
tx = tx.inner_tx.v1!.tx
Method initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(
source_account:,
sequence_number:,
base_fee: 100,
time_bounds: nil,
- 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 describe
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe
case switch
when ClaimPredicateType::UNCONDITIONAL
"always"
when ClaimPredicateType::BEFORE_RELATIVE_TIME
Method verify_challenge_tx_signers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.verify_challenge_tx_signers(server:, challenge_xdr:, signers:)
raise InvalidSep10ChallengeError, "no signers provided" if signers.empty?
te, _ = read_challenge_tx(server: server, challenge_xdr: challenge_xdr)
- 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 lookup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.lookup(federated_name)
_, domain = federated_name.split("*")
if domain.nil?
raise InvalidFederationAddress.new
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"
Further reading
Method evaluate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(created_at, claiming_at)
created_at = created_at.to_time if created_at.respond_to?(:to_time)
claiming_at = created_at + claiming_at if claiming_at.is_a?(ActiveSupport::Duration)
claiming_at = claiming_at.to_time if claiming_at.respond_to?(:to_time)
- 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 from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.from(number)
number = BigDecimal(number, 0) if number.is_a?(String)
number = number.to_r if number.respond_to?(:to_r)
raise ArgumentError, "Couldn't convert #{number.class} to rational number" unless number.is_a?(Rational)
- 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 make
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make(thresholds = {})
# error if any of the needed components are not provided
if COMPONENTS.any? { |c| thresholds[c].blank? }
raise ArgumentError, "invalid thresholds hash, must have #{COMPONENTS.inspect} keys, had: #{thresholds.keys.inspect}"
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"
Further reading
Method build_challenge_tx
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.build_challenge_tx(server:, client:, domain: nil, timeout: 300, **options)
if domain.blank? && options.key?(:anchor_name)
ActiveSupport::Deprecation.new("next release", "stellar-sdk").warn <<~MSG
SEP-10 v2.0.0 requires usage of service home domain instead of anchor name in the challenge transaction.
Please update your implementation to use `Stellar::SEP10.build_challenge_tx(..., home_domain: 'example.com')`.
- 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"