Showing 1,025 of 1,025 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if cls.nil?
flash.now[:error] = "Unrecognised technology type"
elsif !params[:label].blank? && params[:label].downcase != cls.label.downcase
flash.now[:notice] = "Undefined technology type with label <b> #{params[:label]} </b>. Did you mean #{view_context.link_to(cls.label, technology_types_path(:uri=>uri, :label=> cls.label),{:style=> "font-style:italic;font-weight:bold;"})}?".html_safe
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 52.
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 activateSheet
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activateSheet(sheet, sheetTab) {
if (sheetTab == null) {
var i = sheet - 1;
sheetTab = $j("a.sheet_tab:eq(" + i + ")");
}
Function onclick
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
click_tab.onclick = function(){
deactivate_previous_tab(this);
click_tab.parentElement.className = 'tabberactive';
//if the content of the click_tab is already loaded, just show it, otherwise call ajax to get the content
Function animateNode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function animateNode(node){
var nodes = cy.$('node');
var edges = cy.$('edge');
//first normalizing all nodes and fading all nodes and edges
Method rows_to_flot_data
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rows_to_flot_data rows
data = {}
labels = []
rows.each_with_index do |row,y|
t=nil
Method initialize_default_folders
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.initialize_default_folders project, yaml_path=File.join(Rails.root,"config","default_data","default_project_folders.yml")
raise Exception.new("This #{I18n.t('project')} already has folders defined") unless ProjectFolder.root_folders(project).empty?
yaml = YAML.load(ERB.new(File.read(yaml_path)).result)
folders={}
Method new_version
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_version
if handle_upload_data
comments=params[:revision_comment]
respond_to do |format|
Method fetch
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch
@project=Project.find(params[:project])
@project.decrypt_credentials
if @project.site_root_uri.blank?
flash.now[:error]="No remote site location defined"
Method administer_update
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def administer_update
had_no_projects = @person.work_groups.empty?
passed_params= {:roles => User.admin_logged_in?,
:roles_mask => User.admin_logged_in?,
Method index
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if Seek::Config.solr_enabled
perform_search
else
Method handle_download
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_download disposition='attachment', image_size=nil
if @content_blob.url.blank?
if @content_blob.file_exists?
if image_size && @content_blob.is_image?
@content_blob.copy_image
Method create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
topic_saved, post_saved = false, false
# this is icky - move the topic/first post workings into the topic model?
Topic.transaction do
@topic = @forum.topics.build(:title => params[:topic][:title])
Method builder_content
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def builder_content content_blob
filepath=content_blob.filepath
#this is necessary to get the correct filename and especially extension, which JWS relies on
tmpfile = Tempfile.new([content_blob.original_filename,File.extname(content_blob.original_filename)])
Method update_features_enabled
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_features_enabled
Seek::Config.public_seek_enabled= string_to_boolean(params[:public_seek_enabled] || true)
Seek::Config.events_enabled= string_to_boolean params[:events_enabled]
Seek::Config.jerm_enabled= string_to_boolean params[:jerm_enabled]
Seek::Config.email_enabled= string_to_boolean params[:email_enabled]
Method create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
group_name = white_list(params[:favourite_group_name])
already_exists = FavouriteGroup.where(:name => group_name, :user_id => current_user.id).first
unless already_exists
Method extract_from_document
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_from_document doc
doc.root.namespaces.default_prefix = "ss"
template_sheet = nil
Similar blocks of code found in 2 locations. Consider refactoring. Open
{:url => url_for(:action => 'related_items_tab_ajax'),
:method => "get",
:condition => "check_tab_content('#{tab_content_view_some}', '#{tab_content_view_all}')",
:with => "'resource_type=' + '#{resource_type}'
+ '&scale_title=' + '#{scale_title}'
- 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
{:url => url_for(:action => 'related_items_tab_ajax'),
:method => "get",
:condition => "check_tab_content('#{tab_content_view_all}', '#{tab_content_view_some}')",
:with => "'resource_type=' + '#{resource_type}'
+ '&scale_title=' + '#{scale_title}'
- 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
if(slider.settings.mode == 'horizontal'){
distance = slider.touch.end.x - slider.touch.start.x;
value = slider.touch.originalPos.left;
}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 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
}else{
distance = slider.touch.end.y - slider.touch.start.y;
value = slider.touch.originalPos.top;
}
- 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