mirror of
https://github.com/samsonjs/simple_oauth.git
synced 2026-04-27 14:57:45 +00:00
%w-literals should be delimited by ( and )
This commit is contained in:
parent
91a007358c
commit
acfc793be6
3 changed files with 43 additions and 78 deletions
99
.rubocop.yml
99
.rubocop.yml
|
|
@ -1,89 +1,54 @@
|
||||||
AllCops:
|
Metrics/BlockNesting:
|
||||||
Include:
|
Max: 1
|
||||||
- 'Gemfile'
|
|
||||||
- 'Rakefile'
|
|
||||||
- 'simple_oauth.gemspec'
|
|
||||||
|
|
||||||
# Avoid long parameter lists
|
Metrics/LineLength:
|
||||||
ParameterLists:
|
AllowURI: true
|
||||||
Max: 4
|
|
||||||
CountKeywordArgs: true
|
|
||||||
|
|
||||||
ClassLength:
|
|
||||||
Max: 100
|
|
||||||
|
|
||||||
LineLength:
|
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
MethodLength:
|
Metrics/MethodLength:
|
||||||
CountComments: false
|
CountComments: false
|
||||||
Max: 7
|
Max: 7
|
||||||
|
|
||||||
# Avoid more than `Max` levels of nesting.
|
Metrics/ParameterLists:
|
||||||
BlockNesting:
|
Max: 4
|
||||||
Max: 1
|
CountKeywordArgs: true
|
||||||
|
|
||||||
# Align with the style guide.
|
Style/AccessModifierIndentation:
|
||||||
CollectionMethods:
|
EnforcedStyle: outdent
|
||||||
|
|
||||||
|
Style/CollectionMethods:
|
||||||
PreferredMethods:
|
PreferredMethods:
|
||||||
map: 'collect'
|
map: 'collect'
|
||||||
reduce: 'inject'
|
reduce: 'inject'
|
||||||
find: 'detect'
|
find: 'detect'
|
||||||
find_all: 'select'
|
find_all: 'select'
|
||||||
|
|
||||||
# Disable documentation checking until a class needs to be documented once
|
Style/Documentation:
|
||||||
Documentation:
|
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Enforce Ruby 1.8-compatible hash syntax
|
Style/DotPosition:
|
||||||
HashSyntax:
|
EnforcedStyle: trailing
|
||||||
|
|
||||||
|
Style/DoubleNegation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/EachWithObject:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Encoding:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/HashSyntax:
|
||||||
EnforcedStyle: hash_rockets
|
EnforcedStyle: hash_rockets
|
||||||
|
|
||||||
# No spaces inside hash literals
|
Style/Lambda:
|
||||||
SpaceInsideHashLiteralBraces:
|
|
||||||
EnforcedStyle: no_space
|
|
||||||
|
|
||||||
# Allow dots at the end of lines
|
|
||||||
DotPosition:
|
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Don't require magic comment at the top of every file
|
Style/RaiseArgs:
|
||||||
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
|
EnforcedStyle: compact
|
||||||
|
|
||||||
TrailingComma:
|
Style/SpaceInsideHashLiteralBraces:
|
||||||
Enabled: false
|
EnforcedStyle: no_space
|
||||||
|
|
||||||
PercentLiteralDelimiters:
|
Style/TrailingComma:
|
||||||
PreferredDelimiters:
|
EnforcedStyleForMultiline: 'comma'
|
||||||
'%': ()
|
|
||||||
'%i': ()
|
|
||||||
'%q': ()
|
|
||||||
'%Q': ()
|
|
||||||
'%r': '{}'
|
|
||||||
'%s': ()
|
|
||||||
'%w': '[]'
|
|
||||||
'%W': '[]'
|
|
||||||
'%x': ()
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,13 @@ Gem::Specification.new do |spec|
|
||||||
spec.version = '0.2.0'
|
spec.version = '0.2.0'
|
||||||
|
|
||||||
spec.authors = ['Steve Richert', 'Erik Michaels-Ober']
|
spec.authors = ['Steve Richert', 'Erik Michaels-Ober']
|
||||||
spec.email = %w[steve.richert@gmail.com sferik@gmail.com]
|
spec.email = %w(steve.richert@gmail.com sferik@gmail.com)
|
||||||
spec.description = 'Simply builds and verifies OAuth headers'
|
spec.description = 'Simply builds and verifies OAuth headers'
|
||||||
spec.summary = spec.description
|
spec.summary = spec.description
|
||||||
spec.homepage = 'https://github.com/laserlemon/simple_oauth'
|
spec.homepage = 'https://github.com/laserlemon/simple_oauth'
|
||||||
spec.licenses = %w[MIT]
|
spec.licenses = %w(MIT)
|
||||||
|
|
||||||
spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
||||||
spec.test_files = spec.files.grep(/^test\//)
|
spec.test_files = spec.files.grep(/^test\//)
|
||||||
spec.require_paths = %w[lib]
|
spec.require_paths = %w(lib)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ describe SimpleOAuth::Header do
|
||||||
if RUBY_VERSION >= '1.9'
|
if RUBY_VERSION >= '1.9'
|
||||||
test_special_characters
|
test_special_characters
|
||||||
else
|
else
|
||||||
%w[n N e E s S u U].each do |kcode|
|
%w(n N e E s S u U).each do |kcode|
|
||||||
describe %(when $KCODE = "#{kcode}") do
|
describe %(when $KCODE = "#{kcode}") do
|
||||||
original_kcode = $KCODE # rubocop:disable GlobalVars
|
original_kcode = $KCODE # rubocop:disable GlobalVars
|
||||||
begin
|
begin
|
||||||
|
|
@ -298,7 +298,7 @@ describe SimpleOAuth::Header do
|
||||||
describe '#normalized_params' do
|
describe '#normalized_params' do
|
||||||
let(:header) do
|
let(:header) do
|
||||||
header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/1/statuses/friendships.json', {})
|
header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/1/statuses/friendships.json', {})
|
||||||
allow(header).to receive(:signature_params).and_return([%w[A 4], %w[B 3], %w[B 2], %w[C 1], ['D[]', '0 ']])
|
allow(header).to receive(:signature_params).and_return([%w(A 4), %w(B 3), %w(B 2), %w(C 1), ['D[]', '0 ']])
|
||||||
header
|
header
|
||||||
end
|
end
|
||||||
let(:signature_params) { header.send(:signature_params) }
|
let(:signature_params) { header.send(:signature_params) }
|
||||||
|
|
@ -320,12 +320,12 @@ describe SimpleOAuth::Header do
|
||||||
it 'combines OAuth header attributes, body parameters and URL parameters into an flattened array of key/value pairs' do
|
it 'combines OAuth header attributes, body parameters and URL parameters into an flattened array of key/value pairs' do
|
||||||
allow(header).to receive(:attributes).and_return(:attribute => 'ATTRIBUTE')
|
allow(header).to receive(:attributes).and_return(:attribute => 'ATTRIBUTE')
|
||||||
allow(header).to receive(:params).and_return('param' => 'PARAM')
|
allow(header).to receive(:params).and_return('param' => 'PARAM')
|
||||||
allow(header).to receive(:url_params).and_return([%w[url_param 1], %w[url_param 2]])
|
allow(header).to receive(:url_params).and_return([%w(url_param 1), %w(url_param 2)])
|
||||||
expect(signature_params).to eq [
|
expect(signature_params).to eq [
|
||||||
[:attribute, 'ATTRIBUTE'],
|
[:attribute, 'ATTRIBUTE'],
|
||||||
%w[param PARAM],
|
%w(param PARAM),
|
||||||
%w[url_param 1],
|
%w(url_param 1),
|
||||||
%w[url_param 2]
|
%w(url_param 2)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -338,12 +338,12 @@ describe SimpleOAuth::Header do
|
||||||
|
|
||||||
it 'returns an array of key/value pairs for each query parameter' do
|
it 'returns an array of key/value pairs for each query parameter' do
|
||||||
header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/1/statuses/friendships.json?test=TEST', {})
|
header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/1/statuses/friendships.json?test=TEST', {})
|
||||||
expect(header.send(:url_params)).to eq [%w[test TEST]]
|
expect(header.send(:url_params)).to eq [%w(test TEST)]
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sorts values for repeated keys' do
|
it 'sorts values for repeated keys' do
|
||||||
header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/1/statuses/friendships.json?test=3&test=1&test=2', {})
|
header = SimpleOAuth::Header.new(:get, 'https://api.twitter.com/1/statuses/friendships.json?test=3&test=1&test=2', {})
|
||||||
expect(header.send(:url_params)).to eq [%w[test 1], %w[test 2], %w[test 3]]
|
expect(header.send(:url_params)).to eq [%w(test 1), %w(test 2), %w(test 3)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue