Showing 1,379 of 1,379 total issues
Function setHeight
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
setHeight(height, units = 'px', defaultHeight = '20') {
// Don't set the height if someone has already set it
let foundSetting = null
if (this.widgetIndex !== null) {
foundSetting = this.settings.find(
Function setWidth
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
setWidth(width, units = 'px', defaultWidth = '120') {
// Don't set the width if someone has already set it
// This is important in PacketViewer which uses the value-widget
// and passes an explicit width setting to use
let foundSetting = null
Method update_raw_hour_day_stats
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_raw_hour_day_stats(reduced, state)
# Update statistics for this packet's raw values
state.raw_max_values.each do |key, value|
if value
max_key = "#{key}__X"
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(target_name = nil, packet_name = nil, default_endianness = :BIG_ENDIAN, description = nil, buffer = nil, item_class = PacketItem)
super(default_endianness, buffer, item_class)
# Explicitly call the defined setter methods
self.target_name = target_name
self.packet_name = packet_name
Method disconnect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def disconnect
@cancel_threads = true
@read_queue << nil if @read_queue
@listen_pipes.each do |pipe|
pipe.write('.')
Method connect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connect
if @read_port and @write_dest_port and @write_src_port and (@read_port == @write_src_port)
@read_socket = UdpReadWriteSocket.new(
@read_port,
@bind_address,
Method to_xtce_string
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_xtce_string(item, param_or_arg, xml, string_or_binary)
# TODO: OpenC3 Variably sized strings are not supported in XTCE
attrs = { :name => (item.name + '_Type') }
attrs[:characterWidth] = 8 if string_or_binary == 'String'
if item.default && !item.array_size
Method build_target_archive
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_target_archive(temp_dir, target_folder)
target_files = []
Find.find(target_folder) { |file| target_files << file }
target_files.sort!
@id = OpenC3.hash_files(target_files, nil, 'SHA256').hexdigest
Method process_array_type
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_array_type(element, bit_size)
array_num_items = 1
# Need to determine dimensions
xtce_recurse_element(element) do |block_element|
if block_element.name == 'Dimension'
Method normalize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.normalize(target_name, packet_name, item_name, type: :ALL, scope: $openc3_scope)
hash = Store.hget("#{scope}__override__#{target_name}", packet_name)
hash = JSON.parse(hash, :allow_nan => true, :create_additions => true) if hash
hash ||= {} # In case the above didn't create anything
case type
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(commands, telemetry, output_dir)
FileUtils.mkdir_p(output_dir)
# Build target list
targets = []
Method write_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_data(data, extra = nil)
# Intentionally not calling super()
need_insert = false
result_data = ''
Method overrides
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.overrides(scope: $openc3_scope)
overrides = []
TargetModel.names(scope: scope).each do |target_name|
all = Store.hgetall("#{scope}__override__#{target_name}")
next if all.nil? or all.empty?
Method process_ref_entry
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_ref_entry(element)
reference_location, bit_offset = xtce_handle_location_in_container_in_bits(element)
object, type, data_type, array_type = get_object_types(element)
bit_size = Integer(type.sizeInBits)
if array_type
Method convert_to_type
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.convert_to_type(value, item)
return value if value.nil?
case item.data_type
when :OBJECT, :ARRAY
# Do nothing for complex object types
Method create_table
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_table(tables, warnings)
params = @parser.parameters
table_name = params[0].to_s.upcase
endianness = params[1].to_s.upcase.to_sym
if endianness != :BIG_ENDIAN && endianness != :LITTLE_ENDIAN
Method action
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def action
begin
yield
rescue ArgumentError, TypeError => e
logger.error(e.formatted)
Similar blocks of code found in 3 locations. Consider refactoring. Open
class TelemetryReducedHourTopic < Topic
def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
OpenC3.in_span("write") do
# Write to stream
msg_hash = {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 51.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
module ApplicationCable
class Connection < ActionCable::Connection::Base
include OpenC3::Authorization
identified_by :uuid
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 51.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
class TelemetryReducedMinuteTopic < Topic
def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
OpenC3.in_span("write") do
# Write to stream
msg_hash = {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 51.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76