Showing 1,379 of 1,379 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
sourceEditor = acediff.editors.right
targetEditor = acediff.editors.left
startLine = diff.rightStartLine
endLine = diff.rightEndLine
- 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 77.
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
if (dir === C.LTR) {
sourceEditor = acediff.editors.left
targetEditor = acediff.editors.right
startLine = diff.leftStartLine
endLine = diff.leftEndLine
- 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 77.
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 simplifyDiffs
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function simplifyDiffs(acediff, diffs) {
const groupedDiffs = []
function compare(val) {
return acediff.options.diffGranularity === C.DIFF_GRANULARITY_SPECIFIC
Method as_json
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def as_json(*a)
config = {}
config['target_name'] = @target_name.to_s
config['packet_name'] = @packet_name.to_s
config['endianness'] = @default_endianness.to_s
Method get_check_overflow_ranges
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_check_overflow_ranges(bit_size, data_type)
min_value = 0 # Default for UINT cases
case bit_size
when 8
Method initialize
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(port_name = 'COM1',
baud_rate = 9600,
parity = :NONE,
stop_bits = 1,
write_timeout = 10.0,
Method update_local_plugin
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.update_local_plugin(plugin_file_path, plugin_hash, old_plugin_name: nil, scope:)
if ENV['OPENC3_LOCAL_MODE'] and Dir.exist?(OPENC3_LOCAL_MODE_PATH)
variables = plugin_hash['variables']
if variables
PluginModel::RESERVED_VARIABLE_NAMES.each do |name|
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (
Object.prototype.toString.call(value[i]).slice(8, -1) === 'String'
) {
returnValue += '"' + value[i] + '"'
} 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 76.
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
if (
Object.prototype.toString.call(value[i]).slice(8, -1) === 'String'
) {
result += '"' + value[i] + '"'
} 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 76.
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 reaction_enabled_event(msg_hash)
@logger.debug "ReactionMicroservice reaction enabled msg_hash: #{msg_hash}"
reaction = JSON.parse(msg_hash['data'], :allow_nan => true, :create_additions => true)
@share.reaction_base.update(reaction: reaction)
- 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 79.
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 reaction_created_event(msg_hash)
@logger.debug "ReactionMicroservice reaction created msg_hash: #{msg_hash}"
reaction = JSON.parse(msg_hash['data'], :allow_nan => true, :create_additions => true)
@share.reaction_base.add(reaction: reaction)
- 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 79.
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 diff_lineMode_
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
diff_match_patch.prototype.diff_lineMode_ = function (text1, text2, deadline) {
// Scan the text on a line-by-line basis first.
var a = this.diff_linesToChars_(text1, text2)
text1 = a.chars1
text2 = a.chars2
Method deploy
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deploy(gem_path, variables, validate_only: false)
variables["target_name"] = @name
start_path = "/targets/#{@folder_name}/"
temp_dir = Dir.mktmpdir
found = false
Method extract_fields_from_cmd_text
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_fields_from_cmd_text(text, scope: $openc3_scope)
split_string = text.split(/\s+with\s+/i, 2)
raise "ERROR: text must not be empty" if split_string.length == 0
raise "ERROR: 'with' must be followed by parameters : #{text}" if (split_string.length == 1 and text =~ /\s*with\s*/i) or (split_string.length == 2 and split_string[1].empty?)
Method process_file
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_file(filename, targets_config_dir)
parser = ConfigParser.new("https://docs.openc3.com/docs")
# First pass - Everything except targets
parser.parse_file(filename) do |keyword, parameters|
Consider simplifying this complex logical expression. Open
if "expect" in line and ".to eql" in line:
line = line.replace("expect(", "self.assertEqual(")
line = re.sub(r"\)\.to eql(.*)", r", \1)", line)
elif "expect" in line and ".to eq" in line:
line = line.replace("expect(", "self.assertEqual(")
Method read
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read
raise "Interface not connected for read: #{@name}" unless connected?
raise "Interface not readable: #{@name}" unless read_allowed?
first = true
Method initialize
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(write_port_name,
read_port_name,
baud_rate,
parity,
stop_bits,
Method evaluate_trigger
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def evaluate_trigger(head:, trigger:, visited:, triggers:)
if visited["#{trigger.name}__R"]
return visited["#{trigger.name}__R"]
end
if visited["#{trigger.name}__P"].nil?
Method from_json
has 49 lines of code (exceeds 25 allowed). Consider refactoring. 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']