unageanu/jiji2

View on GitHub
sample_agents/src/tensorflow_sample_agent.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method calculate_ma_signals has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def calculate_ma_signals(signals, price, ma10, ma25, ma50)
Severity: Minor
Found in sample_agents/src/tensorflow_sample_agent.rb - About 35 mins to fix

    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
    Severity: Minor
    Found in sample_agents/src/tensorflow_sample_agent.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 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
    Severity: Minor
    Found in sample_agents/src/tensorflow_sample_agent.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

    unexpected token tLSHFT (Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
    Open

        <<~STR

    There are no issues that match your filters.

    Category
    Status