Showing 842 of 1,379 total issues
Method from_json
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.from_json(hash)
endianness = hash['endianness'] ? hash['endianness'].intern : nil # Convert to symbol
packet = Packet.new(hash['target_name'], hash['packet_name'], endianness, hash['description'])
packet.short_buffer_allowed = hash['short_buffer_allowed']
packet.hazardous = hash['hazardous']
Method handle_packet
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def handle_packet(packet)
RouterStatusModel.set(@interface.as_json(:allow_nan => true), scope: @scope)
if !packet.identified?
# Need to identify so we can find the target
identified_packet = System.commands.identify(packet.buffer(false), @interface.cmd_target_names)
Method listen_thread_body
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def listen_thread_body(listen_socket, listen_write, listen_read, thread_reader)
begin
socket, address = listen_socket.accept_nonblock
rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR, Errno::EWOULDBLOCK
read_ready, _ = IO.select([listen_socket, thread_reader])
Method screen_to_autocomplete_hash
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def screen_to_autocomplete_hash(autocomplete_data, keyword, data)
# The snippet is what gets put in the file when you autocomplete
# Thus we put the keyword with all the parameters surround by <>
# e.g. SCREEN <Width> <Height> <Polling Period>
# Example of building snippets:
Function formatValue
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
formatValue(value) {
if (
value &&
this.valueId &&
(this.valueId.includes('PACKET_TIMEFORMATTED') ||
Function diff_fromDelta
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
diff_match_patch.prototype.diff_fromDelta = function (text1, delta) {
var diffs = []
var diffsLength = 0 // Keeping our own length var is faster in JS.
var pointer = 0 // Cursor in text1
var tokens = delta.split(/\t/g)
Function patch_addContext_
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
diff_match_patch.prototype.patch_addContext_ = function (patch, text) {
if (text.length == 0) {
return
}
if (patch.start2 === null) {
Method run
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.run
# Add parent to preexisting scope microservies and deploy new periodic and multi
ScopeModel.get_all_models(scope: nil).each do |scope, scope_model|
parent = "#{scope}__SCOPEMULTI__#{scope}"
model = MicroserviceModel.get_model(name: "#{scope}__OPENC3__LOG", scope: scope)
Method undeploy
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def undeploy
errors = []
microservice_count = 0
microservices = MicroserviceModel.find_all_by_plugin(plugin: @name, scope: @scope)
microservices.each do |_name, model_instance|
Method initialize
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(
name:,
folder_name: nil,
requires: [],
ignored_parameters: [],
Method to_xtce_int
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_xtce_int(item, param_or_arg, xml)
attrs = { :name => (item.name + '_Type') }
attrs[:initialValue] = item.default if item.default and !item.array_size
attrs[:shortDescription] = item.description if item.description
if item.states and item.default and item.states.key(item.default)
Function exec
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async exec(
method,
params,
kwparams = {},
headerOptions = {},
Method handle_limits_values
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def handle_limits_values(item, value, limits_set, ignore_persistence)
# Retrieve limits settings for the specified limits_set
limits = item.limits.values[limits_set]
# Use the default limits set if limits aren't specified for the
Method build_cmd_output_string
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_cmd_output_string(target_name, cmd_name, cmd_params, raw = false)
if raw
output_string = 'cmd_raw("'
else
output_string = 'cmd("'
Method write
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def write(packet)
raise "Interface not connected for write: #{@name}" unless connected?
raise "Interface not writable: #{@name}" unless write_allowed?
_write do
Method instrument_script_implementation
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.instrument_script_implementation(ruby_lex_utils,
comments_removed_text,
_num_lines,
filename,
mark_private = false)
Method api
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def api
OpenC3.in_span('jsonrpc_api') do |span|
req = Rack::Request.new(request.env)
if request.post?
Function applySetting
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
applySetting(style, setting) {
switch (setting[0]) {
case 'TEXTALIGN':
style['text-align'] = setting[1].toLowerCase() + ' !important'
style['--text-align'] = setting[1].toLowerCase()
Method wait_check_tolerance
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def wait_check_tolerance(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token, &block)
raise "Invalid type '#{type}' for wait_check_tolerance" unless %i(RAW CONVERTED).include?(type)
target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = _wait_tolerance_process_args(args)
start_time = Time.now.sys
Method write
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.write(event, scope:)
case event[:type]
when :LIMITS_CHANGE
# The current_limits hash keeps only the current limits state of items
# It is used by the API to determine the overall limits state