Showing 122 of 840 total issues
Method convert_option_value_from_oanda
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.convert_option_value_from_oanda(key, value)
key = key.to_s
if value.nil?
nil
elsif value.is_a? Hash
- 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_indexes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_indexes
Mongoid.models.each do |m|
next if m.index_specifications.empty?
next if m.embedded? && !m.cyclic?
- 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_backtest_id_from
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_backtest_id_from(source, key = 'backtest_id', nullable = false)
id = source[key]
return nullable ? nil : not_nil(key) if id.nil? || id.empty?
id == 'rmt' ? nil : BSON::ObjectId.from_string(id)
- 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 carried_out?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def carried_out?(tick) #:nodoc:
current = Utils::PricingUtils
.calculate_entry_price(tick, pair_name, sell_or_buy)
case @type
when :market then true
- 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 initializeActiveTabData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
initializeActiveTabData() {
if (this.activeTab === "trades") {
this.positionTable.initialize( this.selectedBacktest.id );
this.positionTable.load();
this.positionDownloader.initialize(this.selectedBacktest);
- 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
Avoid too many return
statements within this function. Open
return <BacktestPropertiesView model={this.model()} />;
Avoid too many return
statements within this method. Open
return false unless yield(a[i], b[i])
Method rsi
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rsi(data)
prev = nil
tmp = data.each_with_object([0.0, 0.0]) do |i, r|
r[i > prev ? 0 : 1] += (i - prev).abs if prev
prev = i
- 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 adjustStep
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static adjustStep( step, diff ) {
let s = step;
for (let count = diff/s; count > 3; count = diff/s) {
if ( count > 10 ) {
s = s * 10;
- 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 onPropertyChanged
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
onPropertyChanged(k, e) {
if ( e.key === "pageWidth" ) {
this.setState({ handleWidth: e.newValue});
} else if ( e.key === "positionX" || e.key === "temporaryPositionX") {
if (this.state.handlePosition != e.newValue) {
- 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 get_or_create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.get_or_create(get, create)
entity = get.call
return entity if entity
begin
- 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 rename_source
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rename_source(old_name, new_name)
return if old_name == new_name
@mutex.synchronize do
not_found(AgentSource, name: old_name) unless @agents[old_name]
- 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 validate_take_profit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_take_profit(options, sell_or_buy)
price = options[:price]
take_profit = options[:takeProfitOnFill]
return if take_profit.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 process_action
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_action(action, positions)
return nil unless action =~ /trailing\_stop\_\_([a-z]+)_(.*)$/
case Regexp.last_match(1)
when 'close' then
- 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 calculate_ma_signals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_ma_signals(signals, price, ma10, ma25, ma50)
signals.merge!({
ma_10_estrangement: ma10 ? calculate_estrangement(price, ma10) : nil,
ma_25_estrangement: ma25 ? calculate_estrangement(price, ma25) : nil,
ma_50_estrangement: ma50 ? calculate_estrangement(price, ma50) : 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 collect_properties_for_modify
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def collect_properties_for_modify
instance_variables.map { |n| n[1..-1].to_sym }.each_with_object({}) do |name, obj|
next if name == :broker
v = instance_variable_get("@#{name}")
- 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 extract_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_value(column, hash)
if column.is_a?(Array)
column.reduce(hash) { |a, e| a.nil? ? nil : a[e] }
else
hash[column]
- 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 push
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
push(event) {
if (event.type !== "routing") {
if (this.exist(event)) 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 calculate_slope_signals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_slope_signals(signals, ma10, ma25, ma50)
signals.merge!({
slope_10: ma10 ? @ma10v.next_data(ma10) : nil,
slope_25: ma25 ? @ma25v.next_data(ma25) : nil,
slope_50: ma50 ? @ma50v.next_data(ma50) : 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 create_mock_positions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_mock_positions(type)
[
create_mock_position(:AUDJPY, type == :sell_a ? :sell : :buy, 5000),
create_mock_position(:NZDJPY, type == :sell_a ? :buy : :sell, 5000)
]
- 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"