Showing 1,379 of 1,379 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
hasRaw: function () {
for (let i = 0; i < this.currentPackets.length; i++) {
if (this.currentPackets[i].mode === 'RAW') {
return true
}
- 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 70.
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
hasDecom: function () {
for (let i = 0; i < this.currentPackets.length; i++) {
if (this.currentPackets[i].mode === 'DECOM') {
return true
}
- 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 70.
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
def get_all_interface_info(manual: false, scope: $openc3_scope, token: $openc3_token)
authorize(permission: 'system', manual: manual, scope: scope, token: token)
info = []
InterfaceStatusModel.all(scope: scope).each do |_int_name, int|
info << [int['name'], int['state'], int['clients'], int['txsize'], int['rxsize'],
- 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 70.
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
def get_all_router_info(manual: false, scope: $openc3_scope, token: $openc3_token)
authorize(permission: 'system', manual: manual, scope: scope, token: token)
info = []
RouterStatusModel.all(scope: scope).each do |_router_name, router|
info << [router['name'], router['state'], router['clients'], router['txsize'], router['rxsize'],\
- 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 70.
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
Method check_tolerance
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_tolerance(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
raise "Invalid type '#{type}' for check_tolerance" unless %i(RAW CONVERTED).include?(type)
target_name, packet_name, item_name, expected_value, tolerance =
_check_tolerance_process_args(args)
Method handle_output_io
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_output_io(filename = @current_filename, line_number = @current_line_number)
@output_time = Time.now.sys
if @output_io.string[-1..-1] == "\n"
time_formatted = Time.now.sys.formatted
color = 'BLACK'
Identical blocks of code found in 2 locations. Consider refactoring. Open
when 'PORT'
usage = "PORT <Number> <Protocol (Optional)"
parser.verify_num_parameters(1, 2, usage)
begin
@ports << [Integer(parameters[0])]
- 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 69.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
when 'PORT'
usage = "PORT <Number> <Protocol (Optional)"
parser.verify_num_parameters(1, 2, usage)
begin
@ports << [Integer(parameters[0])]
- 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 69.
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
Function digit16
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
diff_match_patch.prototype.digit16 = function (c) {
switch (c) {
case '0':
return 0
case '1':
Method handle_packet
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_packet(packet)
InterfaceStatusModel.set(@interface.as_json(:allow_nan => true), queued: true, scope: @scope)
packet.received_time = Time.now.sys unless packet.received_time
if packet.stored
Method limits_change_callback
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def limits_change_callback(packet, item, old_limits_state, value, log_change)
return if @cancel_thread
# Make a copy because packet_time is frozen
packet_time = packet.packet_time.dup
if value
Method wait
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wait(*args, type: :CONVERTED, quiet: false, scope: $openc3_scope, token: $openc3_token)
time_diff = nil
case args.length
# wait() # indefinitely until they click Go
Method read_packet
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_packet(packet)
if @response_template && @response_packet
# If lines make it this far they are part of a response
@response_packets << packet
return :STOP if @response_packets.length < (@ignore_lines + @response_lines)
Method formatted
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def formatted(
word_size = 1,
words_per_line = 16,
word_separator = ' ',
indent = 0,
Consider simplifying this complex logical expression. Open
if (
instance.cycle_time
and (utc_now - instance.start_time).total_seconds() > instance.cycle_time
):
Logger.debug("Log writer start new file due to cycle time")
Method sync_system_thread_body
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.sync_system_thread_body(scope:, block_ms: nil)
telemetry = System.telemetry.all
topics = ["#{scope}__openc3_limits_events"]
Topic.read_topics(topics, nil, block_ms) do |_topic, _msg_id, event, _redis|
event = JSON.parse(event['event'], :allow_nan => true, :create_additions => true)
Method <=>
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def <=>(other)
return nil unless other.kind_of?(StructureItem)
other_original_bit_offset = other.original_bit_offset
Method linc_interface_command
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def linc_interface_command(packet)
if @error_ignore_commands
@error_ignore_commands.each do |error_ignore_command|
if error_ignore_command.identify?(packet.buffer(false))
linc_cmd = error_ignore_command.clone
Method ensure_public
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ensure_public(bucket)
unless ENV['OPENC3_NO_BUCKET_POLICY']
policy = <<~EOL
{
"Version": "2012-10-17",
Function set_limits
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_limits(