autotelik/datashift_journey

View on GitHub

Showing 11 of 202 total issues

Method build_journey_plan has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def build_journey_plan
        # The Order of sequences should have been preserved as insertion order

        #puts "DEBUG: START PLAN - Processing SEQUENCES\n#{sequence_list.inspect}"

Severity: Minor
Found in lib/datashift_journey/state_machines/planner.rb - About 2 hrs 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 build_split_sequence_events has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def build_split_sequence_events(sequence, prev_seq, next_seq)
        puts "\n\nDEBUG: PROCESS SPLIT SEQ #{sequence.inspect}"
        puts "DEBUG: SPLIT prev_seq #{prev_seq.inspect}"
        puts "DEBUG: SPLIT next_seq #{next_seq.inspect}"

Severity: Minor
Found in lib/datashift_journey/state_machines/planner.rb - About 1 hr 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 build_and_display has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def build_and_display
        state =   params['state']
        factory = params['factory']

        plan = if factory
Severity: Minor
Found in app/controllers/datashift_journey/state_jumper_controller.rb - About 1 hr 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 index has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def index

          state_paths = []

          DatashiftJourney.journey_plan_class.new.state_paths.each_with_index do |s, i|
Severity: Minor
Found in app/controllers/datashift_journey/api/v1/states_controller.rb - About 1 hr to fix

    Method build_triggered_back has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def build_triggered_back(sequence, prev_seq)
            puts "DEBUG: * BUILD triggered Back for #{sequence.inspect}"
    
            # Create back from FIRST item of THIS sequence to LAST entry of EACH previous BRANCH
            branch_sequence_map.branches_for(prev_seq).each do |branch|
    Severity: Minor
    Found in lib/datashift_journey/state_machines/planner.rb - About 55 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 build_triggered_next has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def build_triggered_next(branch, from, to)
            puts "DEBUG: * BUILD triggered Next for #{branch.inspect} Between : #{from.inspect} -> #{to.inspect}"
    
            # N.B sequences can self terminate i.e no further sequences and end of the journey
            return unless from && from != to
    Severity: Minor
    Found in lib/datashift_journey/state_machines/planner.rb - About 35 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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def show
          journey_plan_class = params[:journey_plan_class] ? params[:journey_plan_class].constantize : DatashiftJourney.journey_plan_class
    
          token = params[:id] || params[:journey_plan_id]
    
    
    Severity: Minor
    Found in app/controllers/datashift_journey/journey_ends_controller.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 create_next has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def create_next(from, to, &block)
        raise "Bad transitions supplied for Next - FROM #{from} - TO #{to}" if from.nil? || to.nil?
        if block_given?
          #puts "DEBUG: Creating NEXT transition from #{from} to #{to} with Block from:\n#{caller.first}"
          transition(from => to, on: :skip_fwd, if: block.call)
    Severity: Minor
    Found in lib/datashift_journey/state_machines/state_machine_core_ext.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 validate_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_state
          current_index = journey_plan.current_state_index
    
          view_state = params[:rendered_state]
    
    
    Severity: Minor
    Found in app/controllers/concerns/datashift_journey/validate_state.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def save(params)
            form_params = params.fetch(params_key, {})
    
            data_nodes = form_params["data_nodes"] # =>{"form_field"=>{"0"=>"name", "1"=>"namespace"}, "field_value"=>{"0"=>"dfsdf", "1"=>"ghfghf"}}}
    
    
    Severity: Minor
    Found in app/forms/datashift_journey/collector/base_collector_form.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(journey_plan)
            super(journey_plan)
    
            @journey_plan = journey_plan
    
    
    Severity: Minor
    Found in app/forms/datashift_journey/collector/base_collector_form.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

    Severity
    Category
    Status
    Source
    Language