diff --git a/.rubocop.yml b/.rubocop.yml index 4e7f67b..576f1c2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,89 +1,54 @@ -AllCops: - Include: - - 'Gemfile' - - 'Rakefile' - - 'simple_oauth.gemspec' +Metrics/BlockNesting: + Max: 1 -# Avoid long parameter lists -ParameterLists: - Max: 4 - CountKeywordArgs: true - -ClassLength: - Max: 100 - -LineLength: +Metrics/LineLength: + AllowURI: true Enabled: false -MethodLength: +Metrics/MethodLength: CountComments: false Max: 7 -# Avoid more than `Max` levels of nesting. -BlockNesting: - Max: 1 +Metrics/ParameterLists: + Max: 4 + CountKeywordArgs: true -# Align with the style guide. -CollectionMethods: +Style/AccessModifierIndentation: + EnforcedStyle: outdent + +Style/CollectionMethods: PreferredMethods: map: 'collect' reduce: 'inject' find: 'detect' find_all: 'select' -# Disable documentation checking until a class needs to be documented once -Documentation: +Style/Documentation: Enabled: false -# Enforce Ruby 1.8-compatible hash syntax -HashSyntax: +Style/DotPosition: + EnforcedStyle: trailing + +Style/DoubleNegation: + Enabled: false + +Style/EachWithObject: + Enabled: false + +Style/Encoding: + Enabled: false + +Style/HashSyntax: EnforcedStyle: hash_rockets -# No spaces inside hash literals -SpaceInsideHashLiteralBraces: - EnforcedStyle: no_space - -# Allow dots at the end of lines -DotPosition: +Style/Lambda: 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: +Style/RaiseArgs: EnforcedStyle: compact -TrailingComma: - Enabled: false +Style/SpaceInsideHashLiteralBraces: + EnforcedStyle: no_space -PercentLiteralDelimiters: - PreferredDelimiters: - '%': () - '%i': () - '%q': () - '%Q': () - '%r': '{}' - '%s': () - '%w': '[]' - '%W': '[]' - '%x': () +Style/TrailingComma: + EnforcedStyleForMultiline: 'comma' diff --git a/simple_oauth.gemspec b/simple_oauth.gemspec index 020d3e0..ed15c81 100644 --- a/simple_oauth.gemspec +++ b/simple_oauth.gemspec @@ -4,13 +4,13 @@ Gem::Specification.new do |spec| spec.version = '0.2.0' 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.summary = spec.description 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.test_files = spec.files.grep(/^test\//) - spec.require_paths = %w[lib] + spec.require_paths = %w(lib) end diff --git a/spec/simple_oauth/header_spec.rb b/spec/simple_oauth/header_spec.rb index 1d811dd..e0f5490 100644 --- a/spec/simple_oauth/header_spec.rb +++ b/spec/simple_oauth/header_spec.rb @@ -51,7 +51,7 @@ describe SimpleOAuth::Header do if RUBY_VERSION >= '1.9' test_special_characters 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 original_kcode = $KCODE # rubocop:disable GlobalVars begin @@ -298,7 +298,7 @@ describe SimpleOAuth::Header do describe '#normalized_params' do let(:header) do 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 end 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 allow(header).to receive(:attributes).and_return(:attribute => 'ATTRIBUTE') 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 [ [:attribute, 'ATTRIBUTE'], - %w[param PARAM], - %w[url_param 1], - %w[url_param 2] + %w(param PARAM), + %w(url_param 1), + %w(url_param 2) ] end end @@ -338,12 +338,12 @@ describe SimpleOAuth::Header 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', {}) - expect(header.send(:url_params)).to eq [%w[test TEST]] + expect(header.send(:url_params)).to eq [%w(test TEST)] end 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', {}) - 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