madzhuga/rails_workflow

View on GitHub

Showing 6 of 6 total issues

Method create_columns has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_columns
    {
      rails_workflow_contexts: [
        %i[integer parent_id],
        %i[string parent_type],

    Method process has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def process
          process = ProcessTemplate
                    .where(uuid: template_json['uuid']).first_or_create!
    
          template_json['child_processes'] && template_json['child_processes'].each do |child_process|
    Severity: Minor
    Found in app/services/rails_workflow/process_importer.rb - About 1 hr to fix

      Method prepare_body has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def prepare_body(body)
            if body.is_a? Array
              body.map do |element|
                prepare_body element
              end
      Severity: Minor
      Found in app/models/rails_workflow/context.rb - About 45 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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def process
            process = ProcessTemplate
                      .where(uuid: template_json['uuid']).first_or_create!
      
            template_json['child_processes'] && template_json['child_processes'].each do |child_process|
      Severity: Minor
      Found in app/services/rails_workflow/process_importer.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 execute_in_transaction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute_in_transaction
            with_transaction do
              child_process_runner.start if child_process.present?
              operation.execute if operation.respond_to?(:execute)
              complete
      Severity: Minor
      Found in lib/rails_workflow/operation_runner.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 prepare_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def prepare_data(data)
            if data.is_a? ActiveRecord::Base
              { id: data.id, class: data.class.to_s }
            elsif data.is_a? Array
              data.map do |element|
      Severity: Minor
      Found in app/models/rails_workflow/context.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