Showing 714 of 1,025 total issues
Method included
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included klass
klass.class_eval do
searchable do
text :title do
if self.respond_to?(:title)
Method populate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def populate
begin
@translucent_id = @node.find_first("id").content unless @node.find_first("id").nil?
@author_seek_id = @node.find_first("submitter").content unless @node.find_first("submitter").nil?
if @type=="Model"
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 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 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 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 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 index
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if Seek::Config.solr_enabled
perform_search
else
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 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 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 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 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 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 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 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 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
Method cell_range=
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cell_range= range
start_cell, end_cell = range.split(":")
unless start_cell.nil? || start_cell.match(/^[a-zA-Z]+[1-9][0-9]*$/).nil?
start_cell = start_cell.upcase
self.start_column, self.start_row = from_alpha(start_cell.sub(/[0-9]+/,"")), start_cell.sub(/[A-Z]+/,"").to_i
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function tipShow
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
tipShow : function() {
var scrX = Number(this.xCord);
var scrY = Number(this.yCord);
var tp = parseInt(scrY+15);
var lt = parseInt(scrX+10);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method perform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def perform
todo = ReindexingQueue.order("id ASC").limit(BATCHSIZE).collect do |queued|
todo = queued.item
queued.destroy
todo
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"