app/lib/morph/runner.rb
Class Runner
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Runner
extend T::Sig
include RenderSync::Actions
sig { returns(Run) }
File runner.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Morph
# High level API for running morph scraper. Handles the setting up of default
# configuration if things like Gemfiles are not included (for Ruby)
class Runner
extend T::Sig
Method attach_to_run_and_finish
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def attach_to_run_and_finish(container, since, &block)
if container.nil?
# TODO: Return the status for a compile error
result = Morph::RunResult.new(255, {}, {})
else
Method synch_and_go!
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def synch_and_go!(&block)
scraper = run.scraper
# If this run belongs to a scraper that has just been deleted
# or if the run has already been marked as finished then
# don't do anything
Method compile_and_start_run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def compile_and_start_run(max_lines = Runner.default_max_lines, &block)
# puts "Starting...\n"
run.database.backup
# If the run is not part of a scraper (e.g. through the api) then there won't be a git repository
git_revision = Rugged::Repository.new(run.repo_path).head.target_id unless run.scraper.nil?
Method attach_to_run_and_finish
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def attach_to_run_and_finish(container, since, &block)
if container.nil?
# TODO: Return the status for a compile error
result = Morph::RunResult.new(255, {}, {})
else
- 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 compile_and_start_run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def compile_and_start_run(max_lines = Runner.default_max_lines, &block)
# puts "Starting...\n"
run.database.backup
# If the run is not part of a scraper (e.g. through the api) then there won't be a git repository
git_revision = Rugged::Repository.new(run.repo_path).head.target_id unless run.scraper.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
Avoid too many return
statements within this method. Open
Open
return
Avoid too many return
statements within this method. Open
Open
return