Showing 842 of 1,379 total issues
Method write_entry
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def write_entry(state, plw, type, target_name, packet_name, stored)
return unless state.reduced.length > 0
reduce(type, state.raw_keys, state.converted_keys, state.reduced)
state.reduced.merge!(state.entry_samples)
time = state.entry_time
Method to_hash
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_hash
hash = super()
hash['format_string'] = self.format_string
if self.read_conversion
hash['read_conversion'] = self.read_conversion.to_s
Method get_target_file
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_target_file(path, original: false, scope: $openc3_scope)
part = "targets"
part += "_modified" unless original
# Loop to allow redo when switching from modified to original
loop do
Method setup_targets
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.setup_targets(target_names, base_dir, scope:)
# Nothing to do if there are no targets
return if target_names.nil? or target_names.length == 0
if @@instance.nil?
FileUtils.mkdir_p("#{base_dir}/targets")
Method handle_build_cmd
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def handle_build_cmd(build_cmd_json, msg_id)
build_cmd_hash = JSON.parse(build_cmd_json, allow_nan: true, create_additions: true)
target_name = build_cmd_hash['target_name']
cmd_name = build_cmd_hash['cmd_name']
cmd_params = build_cmd_hash['cmd_params']
Method _cmd
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def _cmd(cmd, cmd_no_hazardous, *args, timeout: nil, log_message: nil, validate: true, scope: $openc3_scope, token: $openc3_token, **kwargs)
extract_string_kwargs_to_args(args, kwargs)
raw = cmd.include?('raw')
no_range = cmd.include?('no_range') || cmd.include?('no_checks')
no_hazardous = cmd.include?('no_hazardous') || cmd.include?('no_checks')
Method convert_data_to_packet
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def convert_data_to_packet(data, extra = nil)
packet = Packet.new(nil, nil, :BIG_ENDIAN, nil, data.to_s)
packet.accessor = HttpAccessor.new(packet)
if extra
# Identify the response
Method update
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update(start:, stop:, kind:, data:, overlap: true)
array = Store.zrangebyscore(@primary_key, @start, @start)
if array.length == 0
raise ActivityError.new "failed to find activity at: #{@start}"
end
Method move_log_file_to_bucket
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.move_log_file_to_bucket(filename, bucket_key, metadata: {})
Thread.new do
client = Bucket.getClient()
orig_filename = nil
Method read
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def read
raise "Attempt to read from write only stream" unless @read_socket
# No read mutex is needed because reads happen serially
begin
Method initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(bucket_path)
@bucket = OpenC3::Bucket.getClient()
@bucket_path = bucket_path
@local_path = nil
@reservation_count = 0
Method create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create
return unless authorization('script_run')
if params['key'].nil? || params['value'].nil?
render json: {
status: 'error',
Function addCopyArrows
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addCopyArrows(acediff, info, diffIndex) {
if (
info.leftEndLine > info.leftStartLine &&
acediff.options.left.copyLinkEnabled
) {
Function __init__
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __init__(
self,
name: str,
folder_name: str = None,
cmd: Optional[list] = None,
Method cleanup
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def cleanup(areas, cleanup_poll_time)
bucket = Bucket.getClient()
while true
break if @cancel_thread
Method update_min_stats
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update_min_stats(reduced, state)
# Update statistics for this packet's raw values
state.raw_values.each do |key, value|
if value
vals_key = "#{key}__VALS"
Method values_and_limits_states
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def values_and_limits_states(item_array, value_types = :CONVERTED)
items = []
# Verify item_array is a nested array
raise(ArgumentError, "item_array must be a nested array consisting of [[tgt,pkt,item],[tgt,pkt,item],...]") unless Array === item_array[0]
Method download
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.download(target_name, scope:)
tmp_dir = Dir.mktmpdir
zip_filename = File.join(tmp_dir, "#{target_name}.zip")
Zip.continue_on_exists_proc = true
zip = Zip::File.open(zip_filename, Zip::File::CREATE)
Method connect
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def connect
(@read_protocols | @write_protocols).each { |protocol| protocol.connect_reset }
periodic_cmds = @options['PERIODIC_CMD']
if periodic_cmds
Method identify
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def identify(packet_data, target_names = nil)
target_names = target_names() unless target_names
target_names.each do |target_name|
target_name = target_name.to_s.upcase