1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Add RuboCop

This commit is contained in:
Erik Michaels-Ober 2014-01-16 05:00:40 +01:00
parent 10acd73cbb
commit e8f5c67627
5 changed files with 107 additions and 51 deletions

51
.gitignore vendored
View file

@ -1,54 +1,11 @@
!.autotest
!.document
!.gemtest
!.gitignore
!.rspec
!.yardopts
*.gem
*.rbc
*.sw[a-z]
*.tmproj
*.tmproject
*.un~
*~
.*
.Spotlight-V100
.Trashes
.\#*
._*
.bundle
.config
.directory
.elc
.loadpath
.project
.redcar
.rvmrc
.yardoc
/.emacs.desktop
/.emacs.desktop.lock
/live
Desktop.ini
Gemfile.lock
Icon?
InstalledFiles
Session.vim
\#*
\#*\#
_yardoc
auto-save-list
coverage
dist/*
doc
doc/
lib/bundler/man
oa-live
pkg
coverage/*
doc/*
log/*
measurement/*
pkg/*
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
tmtags
tramp

82
.rubocop.yml Normal file
View file

@ -0,0 +1,82 @@
AllCops:
Includes:
- 'Gemfile'
- 'Rakefile'
- 'omniauth.gemspec'
# Avoid long parameter lists
ParameterLists:
Max: 4
CountKeywordArgs: true
MethodLength:
CountComments: false
Max: 14
# Avoid more than `Max` levels of nesting.
BlockNesting:
Max: 2
# Align with the style guide.
CollectionMethods:
PreferredMethods:
map: 'collect'
reduce: 'inject'
find: 'detect'
find_all: 'select'
# Do not force public/protected/private keyword to be indented at the same
# level as the def keyword. My personal preference is to outdent these keywords
# because I think when scanning code it makes it easier to identify the
# sections of code and visually separate them. When the keyword is at the same
# level I think it sort of blends in with the def keywords and makes it harder
# to scan the code and see where the sections are.
AccessModifierIndentation:
Enabled: false
# Limit line length
LineLength:
Enabled: false
# Disable documentation checking until a class needs to be documented once
Documentation:
Enabled: false
# Enforce Ruby 1.8-compatible hash syntax
HashSyntax:
EnforcedStyle: hash_rockets
# No spaces inside hash literals
SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
# Allow dots at the end of lines
DotPosition:
Enabled: false
# Don't require magic comment at the top of every file
Encoding:
Enabled: false
# Enforce outdenting of access modifiers (i.e. public, private, protected)
AccessModifierIndentation:
EnforcedStyle: outdent
EmptyLinesAroundAccessModifier:
Enabled: true
# Align ends correctly
EndAlignment:
AlignWith: variable
# Indentation of when/else
CaseIndentation:
IndentWhenRelativeTo: end
IndentOneStep: false
Lambda:
Enabled: false
HandleExceptions:
Exclude:
- 'spec'

View file

@ -12,21 +12,24 @@ group :development do
gem 'guard-rspec'
end
gem 'kramdown'
gem 'plymouth', :platforms => :mri_19
gem 'plymouth', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'pry'
gem 'pry-debugger', :platforms => :mri_19
gem 'pry-debugger', :platforms => [:mri_19, :mri_20, :mri_21]
gem 'rb-fsevent'
end
group :test do
gem 'coveralls', :require => false
gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_18, :ruby_19]
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
gem 'rack-test'
gem 'rspec', '>= 2.14'
gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'simplecov', :require => false
end
platforms :rbx do
gem 'racc'
gem 'rubinius-coverage', '~> 2.0'
gem 'rubysl', '~> 2.0'
end

View file

@ -7,13 +7,16 @@ gem 'yard'
group :test do
gem 'coveralls', :require => false
gem 'json', '>= 1.8.1', :platforms => [:jruby, :rbx, :ruby_18, :ruby_19]
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
gem 'rack-test'
gem 'rspec', '>= 2.11'
gem 'rspec', '>= 2.14'
gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
gem 'simplecov', :require => false
end
platforms :rbx do
gem 'racc'
gem 'rubinius-coverage', '~> 2.0'
gem 'rubysl', '~> 2.0'
end

View file

@ -1,6 +1,17 @@
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
task :test => :spec
begin
require 'rubocop/rake_task'
Rubocop::RakeTask.new
rescue LoadError
task :rubocop do
$stderr.puts 'Rubocop is disabled'
end
end
task :default => [:spec, :rubocop]