Showing 122 of 840 total issues
Consider simplifying this complex logical expression. Open
if ENV['MONGOLAB_URI'] || ENV['MONGODB_URI']
u = URI.parse(ENV['MONGOLAB_URI'] || ENV['MONGODB_URI'])
config = YAML.load_file(mongoid_setting_file)['default']
sessions = config['clients']['default']
Method find_agent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_agent(source_name, m, checked, &block)
return if checked.include? m
return unless m
checked << m
- 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 convert_response_to_order_result
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def convert_response_to_order_result(res, type)
order_opened = res['orderFillTransaction'] ? nil : convert_response_to_order(res['orderCreateTransaction'], type)
trade_opened = nil
trade_reduced = nil
trades_closed = []
- 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 find_class_by
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_class_by(root, path, name)
mod = root
path.each do |step|
not_found(Agent, name: name) unless check_object_is(mod, Module)
not_found(Agent, name: name, step: step) unless mod.const_defined? step
- 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 create
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create(agent, timestamp,
backtest = nil, message = '', actions = [], note = nil, options = nil)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(pair1, pair2, units, distance, broker, logger = nil,
resolver = StatisticalArbitrage::StaticConstantsResolver.new)
Method build_from_tick
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_from_tick(internal_id, pair_name,
units, sell_or_buy, tick, account_currency, options = {})
Function calculateNewRange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
calculateNewRange(start, end) {
if (!this.range) {
return {
start: start,
end: 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
Function createPageSelectorElement
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
createPageSelectorElement(selector, index) {
if (selector.action) {
const className = selector.selected ? "selected" : "";
const palette = Theme.palette;
return (
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, internal_id, pip,
max_trade_units, precision, margin_rate) #:nodoc:
Method calculate_trailing_amount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def calculate_trailing_amount(position, price, amount)
if position.sell_or_buy == :buy
new_price = (price - amount).to_f
trailing_amount&.zero? ?
new_price : [new_price, trailing_amount].max
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(target_pair, sell_or_buy = :buy, trap_interval_pips = 50,
trade_units = 1, profit_pips = 100, logger = nil)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(backtest, agent,
push_notifier, mail_composer, time_source, logger) #:nodoc:
Method order
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def order(pair_id, sell_or_buy, units, type, options, agent)
Method get_or_create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.get_or_create(label, type,
colors, axises, aggregation_type = :agerage, backtest = nil) #:nodoc:
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(backtest, type,
aggregation_type, label, colors, axises) #:nodoc:
Method _eql?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _eql?(other, &block)
return false if other.nil?
return true if equal? other
return false unless other.is_a?(Jiji::Utils::ValueObject)
- 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_trading_information
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize_trading_information(position,
backtest, internal_id, pair_name, units, sell_or_buy)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(account_id, account_currency,
balance, margin_rate, &init) #:nodoc:
Method order
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def order(pair_name, sell_or_buy, units, type = :market, options = {})