Showing 1,379 of 1,379 total issues
Method get_definitions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_definitions(scope, definition_filename, binary_filename = nil)
temp_dir = Dir.mktmpdir
definition = body(scope, definition_filename)
# We might not find the definition, especially if the binary isn't named
# like the convention. If not, and they pass us a binary filename,
Method all
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.all(scope, path_matchers, target: nil, include_temp: false)
target = target.upcase if target
bucket = Bucket.getClient()
if target
Method local_init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.local_init
if ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
puts "Local init running: #{OPENC3_LOCAL_MODE_PATH} exists"
Dir.each_child(OPENC3_LOCAL_MODE_PATH).each do |scope_dir|
next unless File.directory?("#{OPENC3_LOCAL_MODE_PATH}/#{scope_dir}")
Identical blocks of code found in 2 locations. Consider refactoring. Open
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
- 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 57.
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
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
- 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 57.
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
def get_token(username)
if ENV['OPENC3_API_CLIENT'].nil?
ENV['OPENC3_API_PASSWORD'] ||= ENV['OPENC3_SERVICE_PASSWORD']
return OpenC3Authentication.new().token
else
- 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 56.
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
def get_token(username)
if ENV['OPENC3_API_CLIENT'].nil?
ENV['OPENC3_API_PASSWORD'] ||= ENV['OPENC3_SERVICE_PASSWORD']
return OpenC3Authentication.new().token
else
- 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 56.
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 calcLimits
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
calcLimits(limitsSettings) {
if (!limitsSettings) {
return
}
this.yellowLow = Math.round(
Function calcPosition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
calcPosition(value, limitsSettings) {
if (!value || !limitsSettings) {
return
}
let lowValue = limitsSettings[0] - 10 * this.scale
Method read_all_names
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_all_names(value_type = nil, reduced_type = nil)
result = {}
if value_type
case value_type
when :RAW
Method read
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read(ignore_protocol_messages: true, timeout: nil)
start_time = Time.now
while true
message = read_message()
if message
Method footer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def footer
self.puts "Completed #{@context}"
@report << ''
@report << "--- Test Summary ---"
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(name)
super(name, is_plugin: false)
if @config['options']
@config['options'].each do |option|
Method write_to_clients
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def write_to_clients(method, packet_or_data)
@connection_mutex.synchronize do
# Send data to each client - On error drop the client
indexes_to_delete = []
index = 0
Method handle_config
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_config(parser, keyword, parameters)
case keyword
when 'URL'
parser.verify_num_parameters(1, 1, "URL <URL>")
@url = parameters[0]
Method run
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.run
ScopeModel.names.each do |scope|
# Get all existing InterfaceModels and change json for log_raw to log_stream
# Also remove the log key
interface_models = InterfaceModel.all(scope: scope)
Method get_cmd_hazardous
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_cmd_hazardous(*args, manual: false, scope: $openc3_scope, token: $openc3_token, **kwargs)
extract_string_kwargs_to_args(args, kwargs)
case args.length
when 1
target_name, command_name, parameters = extract_fields_from_cmd_text(args[0], scope: scope)
Method convert_microservice_to_process_definition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_microservice_to_process_definition(microservice_name, microservice_config)
process_definition = ["ruby", "plugin_microservice.rb"]
work_dir = "/openc3/lib/openc3/microservices"
env = microservice_config["env"].dup
if microservice_config["needs_dependencies"]
Method update
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
return unless authorization('script_run')
model = @model_class.score(name: params[:name], score: params[:id].to_i, scope: params[:scope])
if model.nil?
render json: { status: 'error', message: NOT_FOUND }, status: 404
Method read
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read(read_length)
if read_length <= (@buffer.length - @buffer_index)
# Return part of the buffer without having to go to the OS
result = @buffer[@buffer_index, read_length]
@buffer_index += read_length