Showing 79 of 89 total issues
File instance.rb
has 731 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'membrane'
require 'steno'
require 'steno/core_ext'
require 'yaml'
Class Instance
has 65 methods (exceeds 20 allowed). Consider refactoring. Open
class Instance < Task
include EventEmitter
STAT_COLLECTION_INTERVAL_SECS = 10
Class StagingTask
has 57 methods (exceeds 20 allowed). Consider refactoring. Open
class StagingTask < Task
class StagingError < StandardError
def initialize(msg)
super("Error staging: #{msg}")
end
File staging_task.rb
has 503 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'tempfile'
require 'tmpdir'
require 'yaml'
require 'shellwords'
Class Bootstrap
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
class Bootstrap
DEFAULT_HEARTBEAT_INTERVAL = 10 # In secs
DEFAULT_METRICS_INTERVAL = 30
DROPLET_REAPER_INTERVAL_SECS = 60
CONTAINER_REAPER_INTERVAL_SECS = 600
File bootstrap.rb
has 428 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "set"
require "steno"
require "steno/config"
require "steno/core_ext"
Method schema
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.schema
::Membrane::SchemaParser.parse do
{
"base_dir" => String,
Method send
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def send(response, iteration, &blk)
if iteration > MAX_RETRIES
blk.call if blk
else
destination = URI.join(@destination, "/internal/dea/staging/#{response[:app_id]}/completed")
- 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
Class Container
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Container
class WardenError < StandardError
attr_reader :result
def initialize(message, response=nil)
Method StreamHandler.ServeHTTP
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
func (handler *StreamHandler) ServeHTTP(writer http.ResponseWriter, r *http.Request) {
var err error
watcher, err := fsnotify.NewWatcher()
if err != 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 download
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def download
logger.debug("admin-buildpacks.download", buildpacks: @buildpacks)
return unless @buildpacks
FileUtils.mkdir_p(@destination_directory)
- 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
Class InstanceRegistry
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class InstanceRegistry
DEFAULT_CRASH_LIFETIME_SECS = 60 * 60
CRASHES_REAPER_INTERVAL_SECS = 10
DEFAULT_STOPPING_LIFETIME_SECS = 60
Class StagingMessage
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class StagingMessage
def initialize(message)
@message = message
end
Class StartMessage
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class StartMessage
def initialize(message)
@message = message
end
Class StagingTaskWorkspace
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class StagingTaskWorkspace
DROPLET_FILE = "droplet.tgz".freeze
BUILDPACK_CACHE_FILE = "buildpack_cache.tgz".freeze
STAGING_LOG = "staging_task.log".freeze
STAGING_INFO = "staging_info.yml".freeze
Method load
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def load
return unless File.exist?(path)
start = Time.now
- 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
Class Config
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Config
DEFAULT_STAGING_DISK_INODE_LIMIT = 200_000
DEFAULT_INSTANCE_DISK_INODE_LIMIT = 200_000
DEFAULT_INSTANCE_NPROC_LIMIT = 512
DEFAULT_ROUTER_REGISTER_INTERVAL_IN_SECONDS = 20
Method StreamHandler.ServeHTTP
has 79 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (handler *StreamHandler) ServeHTTP(writer http.ResponseWriter, r *http.Request) {
var err error
watcher, err := fsnotify.NewWatcher()
if err != nil {
Method upload!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def upload!(&upload_callback)
logger.info("em-upload.begin", destination: URICleaner.clean(@destination))
SyncUpload.new(@source, @destination, @logger).upload! do |http, error|
if error
- 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_instance
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_instance(attributes)
instance = Instance.new(bootstrap, attributes)
begin
instance.validate