Showing 1,379 of 1,379 total issues
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create(update = false)
return unless authorization('admin')
file = params[:plugin]
if file
scope = sanitize_params([:scope])
Method debug
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def debug(debug_text)
handle_output_io()
if not running?
# Capture STDOUT and STDERR
$stdout.add_stream(@output_io)
Method remote_target_files
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.remote_target_files(bucket_client:, prefix:, include_temp: false, path_matchers: nil)
result = Set.new
temp = Set.new
resp = bucket_client.list_objects(
bucket: ENV['OPENC3_CONFIG_BUCKET'],
Method generate_microservice
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.generate_microservice(args)
if args.length < 2 or args.length > 3
abort("Usage: cli generate #{args[0]} <NAME> (--ruby or --python)")
end
Similar blocks of code found in 2 locations. Consider refactoring. Open
case args.length
when 1
target_name, cmd_name, cmd_params = extract_fields_from_cmd_text(args[0], scope: scope)
when 2, 3
target_name = args[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 48.
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
case args.length
when 1
target_name, command_name, parameters = extract_fields_from_cmd_text(args[0], scope: scope)
when 2, 3
target_name = args[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 48.
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 _wait_packet
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _wait_packet(
Function _openc3_script_wait
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _openc3_script_wait(
Consider simplifying this complex logical expression. Open
if (
lastEquality &&
((pre_ins && pre_del && post_ins && post_del) ||
(lastEquality.length < this.Diff_EditCost / 2 &&
pre_ins + pre_del + post_ins + post_del == 3))
Function _openc3_script_wait_value
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _openc3_script_wait_value(
Function _get_overrides
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_overrides(cls, now, tgt_pkt_key, overrides, target_name, packet_name, cache_timeout, scope):
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function check_overflow
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def check_overflow(cls, value, min_value, max_value, hex_max_value, bit_size, data_type, overflow):
Function _openc3_script_wait
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _openc3_script_wait(
Function _wait_packet
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _wait_packet(
Function _openc3_script_wait_value
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _openc3_script_wait_value(
Function check_overflow_array
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def check_overflow_array(cls, values, min_value, max_value, hex_max_value, bit_size, data_type, overflow):
Function write
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def write(cls, value, bit_offset, bit_size, data_type, buffer, endianness, overflow):
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(