Skip to content

Commit

Permalink
Ran RuboCop Style over project.
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahW91 committed Oct 30, 2018
1 parent b0167fa commit e06d6cc
Show file tree
Hide file tree
Showing 430 changed files with 3,252 additions and 2,703 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Metrics/LineLength:
Max: 120
4 changes: 3 additions & 1 deletion Capfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Load DSL and Setup Up Stages
require 'capistrano/setup'
require 'capistrano/deploy'
Expand All @@ -17,4 +19,4 @@ require 'capistrano/sidekiq/monit'
require 'whenever/capistrano'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class BiorubyGenerator < Rails::Generator::Base
def manifest
record do |m|
Expand Down Expand Up @@ -26,4 +28,3 @@ def manifest
end
end
end

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module BiorubyHelper
# frozen_string_literal: true

module BiorubyHelper
include Bio::Shell

def project_workdir
if Bio::Shell.cache[:savedir].match(/\.bioruby$/)
if Bio::Shell.cache[:savedir] =~ /\.bioruby$/
Bio::Shell.cache[:workdir]
else
Bio::Shell.cache[:savedir]
Expand All @@ -15,13 +16,13 @@ def have_results
end

def local_variables
eval("local_variables", Bio::Shell.cache[:binding]) -
eval('local_variables', Bio::Shell.cache[:binding]) -
BiorubyController::HIDE_VARIABLES
end

def render_log(page)
page.insert_html :top, :logs, :partial => "log"
page.replace_html "variables", :partial => "variables"
page.insert_html :top, :logs, partial: 'log'
page.replace_html 'variables', partial: 'variables'
page.hide "methods_#{@number}"
page.hide "classes_#{@number}"
page.hide "modules_#{@number}"
Expand All @@ -31,17 +32,15 @@ def reference_link(class_or_module)
name = class_or_module.to_s
case name
when /Bio::(.+)/
path = $1.split('::').join('/')
path = Regexp.last_match(1).split('::').join('/')
url = "http://bioruby.org/rdoc/classes/Bio/#{path}.html"
when /Chem::(.+)/
path = $1.split('::').join('/')
path = Regexp.last_match(1).split('::').join('/')
url = "http://chemruby.org/rdoc/classes/Chem/#{path}.html"
else
path = name.split('::').join('/')
url = "http://www.ruby-doc.org/core/classes/#{path}.html"
end
return "<a href='#{url}'>#{name}</a>"
"<a href='#{url}'>#{name}</a>"
end

end

12 changes: 7 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

ruby '2.3.3'
Expand All @@ -12,9 +14,9 @@ gem 'pg_search'
gem 'puma', '~> 3.0'
gem 'redis', '~> 3.0' # Use Redis adapter to run Action Cable in production
gem 'sidekiq'
gem 'sidekiq-limit_fetch'
gem 'sidekiq-client-cli'
gem 'sinatra', :require => false # Needed to monitor sidekiq jobs
gem 'sidekiq-limit_fetch'
gem 'sinatra', require: false # Needed to monitor sidekiq jobs

# Asset pipeline
gem 'coffee-rails', '~> 4.2' # Use CoffeeScript for .coffee assets and views
Expand All @@ -32,12 +34,12 @@ gem 'aws-sdk'
gem 'paperclip'

# Javascript
gem 'bootstrap-multiselect_rails' # multi select boxes using bootstrap
gem 'chosen-rails' # Javascript select boxes
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
gem 'jquery-fileupload-rails'
gem 'jquery-turbolinks'
gem 'select2-rails' # Integrate Select2 Javascript library
gem 'bootstrap-multiselect_rails' # multi select boxes using bootstrap

gem 'bcrypt', '~> 3.1.7', platforms: :ruby
gem 'bio' # BioRuby
Expand All @@ -51,14 +53,14 @@ gem 'roo-xls' # Handle excel files
gem 'rubyzip' # Handle zip files
gem 'simple_form'
gem 'slim' # TODO: Used anywhere?
gem 'sprockets-rails', :require => 'sprockets/railtie'
gem 'sprockets-rails', require: 'sprockets/railtie'
# gem 'turbolinks' # Turbolinks makes navigating your web application faster TODO: Does not work unless first changes to js code, in particular data-tables (see http://guides.rubyonrails.org/working_with_javascript_in_rails.html#turbolinks)
gem 'whenever', require: false # Runs scheduled jobs via cron
gem 'will_paginate', '> 3.0' # TODO: Really needed?
gem 'will_paginate-bootstrap' # TODO: Really needed?

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

group :development do
gem 'capistrano', require: false
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

Expand Down
6 changes: 4 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
check_authorization :unless => :devise_controller?
check_authorization unless: :devise_controller?

# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception

rescue_from CanCan::AccessDenied do |exception|
rescue_from CanCan::AccessDenied do |_exception|
redirect_back(fallback_location: root_url, alert: 'You are not authorized to access this page or perform this action.')
end
end
6 changes: 4 additions & 2 deletions app/controllers/concerns/project_concern.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

module ProjectConcern
extend ActiveSupport::Concern

def current_project_id
user_signed_in? ? current_user.default_project_id : Project.where('name like ?', "All%").first.id
user_signed_in? ? current_user.default_project_id : Project.where('name like ?', 'All%').first.id
end
end
end
9 changes: 6 additions & 3 deletions app/controllers/contig_searches_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ContigSearchesController < ApplicationController
load_and_authorize_resource

Expand All @@ -15,8 +17,8 @@ def new
def create
@contig_search = ContigSearch.create!(contig_search_params)

@contig_search.update(:user_id => current_user.id)
@contig_search.update(:project_id => current_user.default_project_id)
@contig_search.update(user_id: current_user.id)
@contig_search.update(project_id: current_user.default_project_id)

redirect_to @contig_search
end
Expand Down Expand Up @@ -51,7 +53,7 @@ def delete_all
def export_as_pde
@contig_search = ContigSearch.find(params[:contig_search_id])
file_name = @contig_search.title.empty? ? "contig_search_#{@contig_search.created_at}" : @contig_search.title
send_data(ContigSearch.pde(@contig_search.contigs.includes(:partial_cons, isolate: [individual: :species]), add_reads: false), :filename => "#{file_name}.pde", :type => "application/txt")
send_data(ContigSearch.pde(@contig_search.contigs.includes(:partial_cons, isolate: [individual: :species]), add_reads: false), filename: "#{file_name}.pde", type: 'application/txt')
end

# TODO: Unfinished feature
Expand All @@ -68,6 +70,7 @@ def export_as_pde
# end

private

# Never trust parameters from the scary internet, only allow the white list through.
def contig_search_params
params.require(:contig_search).permit(:title, :assembled, :has_warnings, :family, :marker, :max_age, :max_update, :min_age, :min_update, :name, :order, :species, :specimen, :verified, :verified_by, :project_id, :search_result_archive)
Expand Down
Loading

0 comments on commit e06d6cc

Please sign in to comment.