mirror of
https://github.com/samsonjs/simple_oauth.git
synced 2026-04-27 14:57:45 +00:00
Add RuboCop
This commit is contained in:
parent
cf00517e81
commit
595ab454c1
4 changed files with 105 additions and 3 deletions
89
.rubocop.yml
Normal file
89
.rubocop.yml
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
AllCops:
|
||||||
|
Includes:
|
||||||
|
- 'Gemfile'
|
||||||
|
- 'Rakefile'
|
||||||
|
- 'simple_oauth.gemspec'
|
||||||
|
|
||||||
|
# Avoid long parameter lists
|
||||||
|
ParameterLists:
|
||||||
|
Max: 4
|
||||||
|
CountKeywordArgs: true
|
||||||
|
|
||||||
|
ClassLength:
|
||||||
|
Max: 100
|
||||||
|
|
||||||
|
LineLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
MethodLength:
|
||||||
|
CountComments: false
|
||||||
|
Max: 7
|
||||||
|
|
||||||
|
# Avoid more than `Max` levels of nesting.
|
||||||
|
BlockNesting:
|
||||||
|
Max: 1
|
||||||
|
|
||||||
|
# Align with the style guide.
|
||||||
|
CollectionMethods:
|
||||||
|
PreferredMethods:
|
||||||
|
map: 'collect'
|
||||||
|
reduce: 'inject'
|
||||||
|
find: 'detect'
|
||||||
|
find_all: 'select'
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
RaiseArgs:
|
||||||
|
EnforcedStyle: compact
|
||||||
|
|
||||||
|
TrailingComma:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
PercentLiteralDelimiters:
|
||||||
|
PreferredDelimiters:
|
||||||
|
'%': ()
|
||||||
|
'%i': ()
|
||||||
|
'%q': ()
|
||||||
|
'%Q': ()
|
||||||
|
'%r': '{}'
|
||||||
|
'%s': ()
|
||||||
|
'%w': '[]'
|
||||||
|
'%W': '[]'
|
||||||
|
'%x': ()
|
||||||
4
Gemfile
4
Gemfile
|
|
@ -5,7 +5,9 @@ gem 'rake'
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'coveralls', :require => false
|
gem 'coveralls', :require => false
|
||||||
gem 'rspec', '>= 2.11'
|
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
|
||||||
|
gem 'rspec', '>= 2.14'
|
||||||
|
gem 'rubocop', '>= 0.19', :platforms => [:ruby_19, :ruby_20, :ruby_21]
|
||||||
gem 'simplecov', :require => false
|
gem 'simplecov', :require => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
13
Rakefile
13
Rakefile
|
|
@ -3,4 +3,15 @@ require 'rspec/core/rake_task'
|
||||||
|
|
||||||
RSpec::Core::RakeTask.new(:spec)
|
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]
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ module SimpleOAuth
|
||||||
:nonce => OpenSSL::Random.random_bytes(16).unpack('H*')[0],
|
:nonce => OpenSSL::Random.random_bytes(16).unpack('H*')[0],
|
||||||
:signature_method => 'HMAC-SHA1',
|
:signature_method => 'HMAC-SHA1',
|
||||||
:timestamp => Time.now.to_i.to_s,
|
:timestamp => Time.now.to_i.to_s,
|
||||||
:version => '1.0'
|
:version => '1.0',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue