Skip to content

Commit

Permalink
Install rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Mar 3, 2016
1 parent 9b4e928 commit 75fbfb7
Show file tree
Hide file tree
Showing 16 changed files with 289 additions and 113 deletions.
115 changes: 115 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
require: rubocop-rspec
inherit_from: .rubocop_todo.yml

AllCops:
DisplayCopNames: true
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'script/**/*'
- 'spec/internal/**/*'
- 'spec/test_app_templates/**/*'
- 'vendor/**/*'

Lint/ImplicitStringConcatenation:
Exclude:
- 'lib/generators/sufia/**/*'

Metrics/LineLength:
Enabled: false

Metrics/AbcSize:
Enabled: false

Metrics/MethodLength:
Enabled: false

Performance/RedundantMerge:
Enabled: false

Style/ZeroLengthPredicate:
Enabled: false

Style/BlockDelimiters:
Exclude:
- 'spec/**/*'

Style/BlockEndNewline:
Exclude:
- 'spec/**/*'

Style/MultilineBlockLayout:
Exclude:
- 'spec/**/*'

Style/IndentationConsistency:
EnforcedStyle: rails

Style/CollectionMethods:
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
detect: 'find'
find_all: 'select'

Style/WordArray:
Enabled: false

Style/RegexpLiteral:
Enabled: false

Style/StringLiterals:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/Documentation:
Enabled: false

Style/LineEndConcatenation:
Exclude:
- 'spec/test_app_templates/lib/generators/**/*'
- 'lib/generators/**/*'

Style/SingleLineBlockParams:
Enabled: false

Style/SignalException:
Enabled: false

Style/ZeroLengthPredicate:
Enabled: false

Rails:
Enabled: true

Rails/Date:
Enabled: false

Rails/TimeZone:
Enabled: false

RSpec/AnyInstance:
Enabled: false

RSpec/ExampleWording:
CustomTransform:
be: is
have: has
not: does not
NOT: does NOT
IgnoredWords:
- only

RSpec/FilePath:
Enabled: false

RSpec/InstanceVariable:
Enabled: false

RSpec/NotToNot:
Enabled: false
57 changes: 57 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Put any overides here
Metrics/ClassLength:
Exclude:
- 'app/controllers/catalog_controller.rb'
# Metrics/ModuleLength:
# Exclude:
# - 'app/controllers/concerns/sufia/users_controller_behavior.rb'
# - 'app/controllers/concerns/sufia/files_controller_behavior.rb'
# - 'app/helpers/sufia/sufia_helper_behavior.rb'
#
# Style/HashSyntax:
# Exclude:
# - 'lib/generators/sufia/templates/catalog_controller.rb'
#
# Style/LineEndConcatenation:
# Exclude:
# - 'spec/test_app_templates/lib/generators/**/*'
# - 'lib/generators/**/*'
#
# Style/PredicateName:
# Exclude:
# - 'app/helpers/sufia/sufia_helper_behavior.rb'
# - 'app/controllers/concerns/sufia/controller.rb'
#
# Style/GlobalVars:
# Exclude:
# - 'spec/**/*'
# - 'spec/jobs/event_jobs_spec.rb'
# - 'lib/generators/sufia/templates/config/redis_config.rb'
# - 'lib/sufia/redis_event_store.rb'
#
# Style/ClassVars:
# Exclude:
# - 'lib/sufia/models.rb'
# - 'lib/sufia.rb'
#
# Rails/Output:
# Exclude:
# - 'lib/generators/**/*'
# - 'app/services/sufia/user_stat_importer.rb'
#
# Rails/HasAndBelongsToMany:
# Exclude:
# - 'app/models/domain_term.rb'
# - 'app/models/local_authority.rb'
#
# RSpec/DescribeClass:
# Exclude:
# - 'spec/javascripts/jasmine_spec.rb'
# - 'spec/tasks/rake_spec.rb'
# - 'spec/jobs/event_jobs_spec.rb'
# - 'spec/config/sufia_events_spec.rb'
# - 'spec/features/**/*'
# - 'spec/views/**/*'
# - 'spec/routing/**/*'
# - 'spec/requests/**/*'
# - 'spec/inputs/**/*'
15 changes: 5 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ gem 'sdoc', '~> 0.4.0', group: :doc
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
Expand All @@ -47,16 +42,16 @@ group :development do
gem 'spring'
end


group :development, :test do
gem 'solr_wrapper', '>= 0.3'
end

gem 'rsolr', '~> 1.0.6'
gem 'globalid'
gem 'devise'
gem 'devise-guests', '~> 0.3'

group :development, :test do
gem 'byebug'
gem 'fcrepo_wrapper'
gem 'solr_wrapper', '>= 0.3'
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-rspec'
end
15 changes: 15 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ GEM
tzinfo (~> 1.1)
addressable (2.4.0)
arel (6.0.3)
ast (2.2.0)
autoprefixer-rails (6.3.3.1)
execjs
babel-source (5.8.35)
Expand Down Expand Up @@ -279,8 +280,11 @@ GEM
nokogiri (>= 1.4.2)
solrizer (~> 3.3)
orm_adapter (0.5.0)
parser (2.3.0.6)
ast (~> 2.2)
parslet (1.7.1)
blankslate (>= 2.0, <= 4.0)
powerpack (0.1.1)
qa (0.5.0)
activerecord-import
deprecation
Expand Down Expand Up @@ -318,6 +322,7 @@ GEM
activesupport (= 4.2.5.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.1.0)
rake (10.5.0)
rdf (1.99.1)
link_header (~> 0.0, >= 0.0.8)
Expand Down Expand Up @@ -411,6 +416,13 @@ GEM
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubocop (0.37.2)
parser (>= 2.3.0.4, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 0.3)
rubocop-rspec (1.4.0)
ruby-progressbar (1.7.5)
rubyzip (1.2.0)
sass (3.4.21)
Expand Down Expand Up @@ -483,6 +495,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (0.3.1)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.2.6)
Expand Down Expand Up @@ -510,6 +523,8 @@ DEPENDENCIES
rails (= 4.2.5.2)
rsolr (~> 1.0.6)
rspec-rails
rubocop
rubocop-rspec
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
solr_wrapper (>= 0.3)
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks

# Get rid of the default task (was spec)
task default: []; Rake::Task[:default].clear
task default: []
Rake::Task[:default].clear

task default: :ci
3 changes: 1 addition & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ApplicationController < ActionController::Base
# Adds a few additional behaviors into the application controller
# Adds a few additional behaviors into the application controller
include Blacklight::Controller
include Hydra::Controller::ControllerBehavior

Expand All @@ -8,7 +8,6 @@ class ApplicationController < ActionController::Base
include CurationConcerns::ThemedLayoutController
with_themed_layout '1_column'


# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
Expand Down
2 changes: 1 addition & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Ability
include Hydra::Ability

include CurationConcerns::Ability
self.ability_logic += [:everyone_can_create_curation_concerns]

Expand Down
19 changes: 8 additions & 11 deletions app/models/solr_document.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
# frozen_string_literal: true
class SolrDocument

class SolrDocument
include Blacklight::Solr::Document
# Adds CurationConcerns behaviors to the SolrDocument.
include CurationConcerns::SolrDocumentBehavior


# self.unique_key = 'id'

# Email uses the semantic field mappings below to generate the body of an email.
SolrDocument.use_extension( Blacklight::Document::Email )
SolrDocument.use_extension(Blacklight::Document::Email)

# SMS uses the semantic field mappings below to generate the body of an SMS email.
SolrDocument.use_extension( Blacklight::Document::Sms )
SolrDocument.use_extension(Blacklight::Document::Sms)

# DublinCore uses the semantic field mappings below to assemble an OAI-compliant Dublin Core document
# Semantic mappings of solr stored fields. Fields may be multi or
# single valued. See Blacklight::Document::SemanticFields#field_semantics
# and Blacklight::Document::SemanticFields#to_semantic_values
# Recommendation: Use field names from Dublin Core
use_extension( Blacklight::Document::DublinCore)

use_extension(Blacklight::Document::DublinCore)

# Do content negotiation for AF models.
# Do content negotiation for AF models.

use_extension( Hydra::ContentNegotiation )
use_extension(Hydra::ContentNegotiation)
end
10 changes: 2 additions & 8 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@ class User < ActiveRecord::Base
include Hydra::User
# Connects this user object to Curation Concerns behaviors.
include CurationConcerns::User



if Blacklight::Utils.needs_attr_accessible?

attr_accessible :email, :password, :password_confirmation
end
# Connects this user object to Blacklights Bookmarks.
# Connects this user object to Blacklights Bookmarks.
include Blacklight::User

# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
Expand Down
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'pathname'

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
Expand Down
4 changes: 1 addition & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@

module Heliotrope
class Application < Rails::Application

config.generators do |g|
g.test_framework :rspec, :spec => true
g.test_framework :rspec, spec: true
end


# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
Mime::Type.register "application/n-triples", :nt
Mime::Type.register "application/ld+json", :jsonld
Mime::Type.register "text/turtle", :ttl
Mime::Type.register 'application/x-endnote-refer', :endnote
Mime::Type.register 'application/x-endnote-refer', :endnote
Loading

0 comments on commit 75fbfb7

Please sign in to comment.