Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 10, 2019
1 parent 0098e94 commit 5475bd6
Show file tree
Hide file tree
Showing 53 changed files with 142 additions and 37 deletions.
2 changes: 2 additions & 0 deletions config/initializers/_shoryuken.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Shoryuken.configure_server do |config|
Rails.logger = Shoryuken::Logging.logger
Rails.logger.level = Logger.const_get(ENV["LOG_LEVEL"].upcase)
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/_token.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# frozen_string_literal: true

# generate token for jwt authentication with Profiles service, valid for 12 months
ENV['VOLPINO_TOKEN'] = User.generate_token(exp: 3600 * 30 * 12)
4 changes: 3 additions & 1 deletion config/initializers/_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Lupo
class Application
g = Git.open(Rails.root)
Expand All @@ -8,4 +10,4 @@ class Application
end
REVISION = g.object('HEAD').sha
end
end
end
2 changes: 2 additions & 0 deletions config/initializers/api_pagination.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

ApiPagination.configure do |config|
config.page_param do |params|
params[:page][:number]
Expand Down
4 changes: 3 additions & 1 deletion config/initializers/audited.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# frozen_string_literal: true

Audited.config do |config|
config.current_user_method = :authenticated_user
config.audit_class = Activity
end
end
4 changes: 3 additions & 1 deletion config/initializers/constants.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class IdentifierError < RuntimeError; end

RESCUABLE_EXCEPTIONS = [CanCan::AccessDenied,
Expand Down Expand Up @@ -56,4 +58,4 @@ class IdentifierError < RuntimeError; end
"citeproc",
"crossref",
"codemeta"
]
]
4 changes: 3 additions & 1 deletion config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Avoid CORS issues when API is called from the frontend app.
Expand All @@ -13,4 +15,4 @@
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head]
end
end
end
4 changes: 3 additions & 1 deletion config/initializers/elasticsearch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'faraday_middleware'
require 'faraday_middleware/aws_sigv4'

Expand All @@ -20,4 +22,4 @@

f.adapter :excon
end
end
end
2 changes: 2 additions & 0 deletions config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Expand Down
10 changes: 6 additions & 4 deletions config/initializers/flipper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
require 'flipper'
require 'flipper/adapters/http'
# frozen_string_literal: true

require "flipper"
require "flipper/adapters/http"
require "active_support/notifications"
require 'active_support/cache'
require 'flipper/adapters/active_support_cache_store'
require "active_support/cache"
require "flipper/adapters/active_support_cache_store"

Flipper.configure do |config|
config.default do
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/gender_detector.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'gender_detector'

::NameDetector = GenderDetector.new
2 changes: 2 additions & 0 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/kaminari_config.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Kaminari.configure do |config|
config.default_per_page = 25
config.max_per_page = 1000
Expand Down
4 changes: 3 additions & 1 deletion config/initializers/lograge.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'elasticsearch/rails/lograge'
# frozen_string_literal: true

require "elasticsearch/rails/lograge"

Rails.application.configure do
config.lograge.enabled = true
Expand Down
3 changes: 2 additions & 1 deletion config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# unregister all Mime types, keep only :text
Mime::EXTENSION_LOOKUP.map { |i| i.first.to_sym }.each do |f|
Mime::Type.unregister(f)
Expand Down Expand Up @@ -72,4 +74,3 @@
options[:header].to_csv +
Array.wrap(obj).map { |o| o.send("csv") }.join("")
end

4 changes: 3 additions & 1 deletion config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

Raven.configure do |config|
config.dsn = ENV["SENTRY_DSN"]
config.release = "lupo:" + Lupo::Application::VERSION
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)

# ignore 502, 503 and 504 from Elasticsearch
config.excluded_exceptions += ['Elasticsearch::Transport::Transport::Errors::BadGateway', 'Elasticsearch::Transport::Transport::Errors::ServiceUnavailable', 'Elasticsearch::Transport::Transport::Errors::GatewayTimeout']
end
end
4 changes: 3 additions & 1 deletion config/initializers/turnout.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

Turnout.configure do |config|
config.default_maintenance_page = Turnout::MaintenancePage::JSON
config.default_allowed_paths = ['^/heartbeat']
config.default_reason = "The site is temporarily down for maintenance. Please check https://status.datacite.org for more information."
end
end
2 changes: 2 additions & 0 deletions config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# This file contains settings for ActionController::ParamsWrapper which
Expand Down
18 changes: 10 additions & 8 deletions db/migrate/20170807091814_create_all_tables.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class CreateAllTables < ActiveRecord::Migration[5.1]
def change
create_table "allocator", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
Expand All @@ -19,8 +21,8 @@ def change
end

create_table "allocator_prefixes", primary_key: ["allocator", "prefixes"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "allocator", :limit => 8, null: false
t.integer "prefixes", :limit => 8, null: false
t.integer "allocator", limit: 8, null: false
t.integer "prefixes", limit: 8, null: false
t.index ["allocator"], name: "FKE7FBD67446EBD781"
t.index ["prefixes"], name: "FKE7FBD674AF86A1C7"
end
Expand All @@ -40,15 +42,15 @@ def change
t.string "symbol", null: false
t.datetime "updated"
t.integer "version"
t.integer "allocator", :limit => 8, null: false
t.integer "allocator", limit: 8, null: false
t.string "experiments"
t.index ["allocator"], name: "FK6695D60546EBD781"
t.index ["symbol"], name: "symbol", unique: true
end

create_table "datacentre_prefixes", primary_key: ["datacentre", "prefixes"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "datacentre", :limit => 8, null: false
t.integer "prefixes", :limit => 8, null: false
t.integer "datacentre", limit: 8, null: false
t.integer "prefixes", limit: 8, null: false
t.index ["datacentre"], name: "FK13A1B3BA47B5F5FF"
t.index ["prefixes"], name: "FK13A1B3BAAF86A1C7"
end
Expand All @@ -63,7 +65,7 @@ def change
t.string "last_metadata_status"
t.datetime "updated"
t.integer "version"
t.integer "datacentre", :limit => 8, null: false
t.integer "datacentre", limit: 8, null: false
t.datetime "minted"
t.index ["datacentre"], name: "FK5605B47847B5F5FF"
t.index ["doi"], name: "doi", unique: true
Expand All @@ -75,7 +77,7 @@ def change
t.datetime "updated"
t.string "url", null: false
t.integer "version"
t.integer "dataset", :limit => 8, null: false
t.integer "dataset", limit: 8, null: false
t.index ["dataset", "updated"], name: "dataset_updated"
t.index ["dataset"], name: "FK62F6FE44D3D6B1B"
end
Expand All @@ -85,7 +87,7 @@ def change
t.integer "metadata_version"
t.integer "version"
t.binary "xml", limit: 16777215
t.integer "dataset", :limit => 8, null: false
t.integer "dataset", limit: 8, null: false
t.binary "is_converted_by_mds", limit: 1
t.string "namespace"
t.index ["dataset", "metadata_version"], name: "dataset_version"
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20170807091837_add_columns_to_allocator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddColumnsToAllocator < ActiveRecord::Migration[5.1]
def change
add_column :allocator, :description, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20170904170626_change_column_in_tables.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ChangeColumnInTables < ActiveRecord::Migration[5.1]
def change
add_column :dataset, :url, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20170908050141_add_deleted_at_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddDeletedAtColumn < ActiveRecord::Migration[5.1]
def change
add_column :allocator, :deleted_at, :datetime, default: nil
Expand Down
6 changes: 4 additions & 2 deletions db/migrate/20170914055227_convert_to_has_many_through.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# frozen_string_literal: true

class ConvertToHasManyThrough < ActiveRecord::Migration[5.1]
def up
execute "ALTER TABLE `allocator_prefixes` DROP PRIMARY KEY"
add_index :allocator_prefixes, [:allocator, :prefixes], :unique => true
add_index :allocator_prefixes, [:allocator, :prefixes], unique: true
add_column :allocator_prefixes, :id, :primary_key
add_column :allocator_prefixes, :created, :datetime
add_column :allocator_prefixes, :updated, :datetime

execute "ALTER TABLE `datacentre_prefixes` DROP PRIMARY KEY"
add_index :datacentre_prefixes, [:datacentre, :prefixes], :unique => true
add_index :datacentre_prefixes, [:datacentre, :prefixes], unique: true
add_column :datacentre_prefixes, :id, :primary_key
add_column :datacentre_prefixes, :created, :datetime
add_column :datacentre_prefixes, :updated, :datetime
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20170916141643_add_allocator_prefixes_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddAllocatorPrefixesColumn < ActiveRecord::Migration[5.1]
def change
add_column :datacentre_prefixes, :allocator_prefixes, :integer, limit: 8
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20170926083943_add_url_index.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddUrlIndex < ActiveRecord::Migration[5.1]
def change
add_column :dataset, :last_landing_page, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20170928202815_addre3data_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class Addre3dataColumn < ActiveRecord::Migration[5.1]
def change
add_column :datacentre, :re3data, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20171109120529_add_aasm_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddAasmColumn < ActiveRecord::Migration[5.1]
def self.up
add_column :dataset, :state, :string, default: "draft"
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20171202002420_rename_state_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class RenameStateColumn < ActiveRecord::Migration[5.1]
def self.up
remove_column :dataset, :state
Expand Down
6 changes: 4 additions & 2 deletions db/migrate/20171202090754_change_url_column_type.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# frozen_string_literal: true

class ChangeUrlColumnType < ActiveRecord::Migration[5.1]
def up
remove_index :dataset, name: "index_dataset_on_url", column: :url
change_column :dataset, :url, :text, limit: 65535
add_index :dataset, :url, name: 'index_dataset_on_url', length: 100
add_index :dataset, :url, name: "index_dataset_on_url", length: 100
end

def down
remove_index :dataset, name: "index_dataset_on_url", column: :url
change_column :dataset, :url, :string
add_index :dataset, :url, name: 'index_dataset_on_url'
add_index :dataset, :url, name: "index_dataset_on_url"
end
end
4 changes: 3 additions & 1 deletion db/migrate/20180116230054_add_client_url.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

class AddClientUrl < ActiveRecord::Migration[5.1]
def change
add_column :datacentre, :url, :text, limit: 65535
add_index :datacentre, :url, name: 'index_datacentre_on_url', length: 100
add_index :datacentre, :url, name: "index_datacentre_on_url", length: 100
end
end
2 changes: 2 additions & 0 deletions db/migrate/20180202063721_add_reason_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddReasonColumn < ActiveRecord::Migration[5.1]
def change
add_column :dataset, :reason, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20180306172317_add_json_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddJsonColumn < ActiveRecord::Migration[5.1]
def change
add_column :dataset, :crosscite, :text, limit: 16777215
Expand Down
6 changes: 4 additions & 2 deletions db/migrate/20180310064742_landing_page_url_as_text.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

class LandingPageUrlAsText < ActiveRecord::Migration[5.1]
def up
change_column :dataset, :last_landing_page, :text, limit: 65535
add_index :dataset, :last_landing_page_status, name: 'index_dataset_on_last_landing_page_status'
add_index :dataset, :last_landing_page_content_type, name: 'index_dataset_on_last_landing_page_content_type'
add_index :dataset, :last_landing_page_status, name: "index_dataset_on_last_landing_page_status"
add_index :dataset, :last_landing_page_content_type, name: "index_dataset_on_last_landing_page_content_type"
end

def down
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20180330040550_add_institution_type_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddInstitutionTypeColumn < ActiveRecord::Migration[5.1]
def up
add_column :allocator, :joined, :date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20180402214555_add_from_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddFromColumn < ActiveRecord::Migration[5.2]
def change
add_column :dataset, :from, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20180505084805_remove_crosscite_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class RemoveCrossciteColumn < ActiveRecord::Migration[5.2]
def change
remove_column :dataset, :from, :string
Expand Down
2 changes: 2 additions & 0 deletions db/migrate/20180731090122_add_source_column.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class AddSourceColumn < ActiveRecord::Migration[5.2]
def change
add_column :dataset, :source, :string, limit: 191
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

class AddLastLandingPageStatusResultColumn < ActiveRecord::Migration[5.2]
def change
add_column :dataset, :last_landing_page_status_result, :json, :after => :last_landing_page_status_check
add_column :dataset, :last_landing_page_status_result, :json, after: :last_landing_page_status_check
end
end
4 changes: 3 additions & 1 deletion db/migrate/20181015152049_microseconds_in_time_columns.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# frozen_string_literal: true

class MicrosecondsInTimeColumns < ActiveRecord::Migration[5.2]
def up
change_column :dataset, :created, :datetime, limit: 3
change_column :dataset, :updated, :datetime, limit: 3

add_column :dataset, :indexed, :datetime, limit: 3, default: '1970-01-01 00:00:00', null: false
add_column :dataset, :indexed, :datetime, limit: 3, default: "1970-01-01 00:00:00", null: false
add_index "dataset", ["created", "indexed", "updated"], name: "index_dataset_on_created_indexed_updated"
end

Expand Down
Loading

0 comments on commit 5475bd6

Please sign in to comment.