Skip to content

Commit

Permalink
Reconfigure RuboCop for Ruby 1.9.3 and greater
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Sep 6, 2015
1 parent 1e3d6f0 commit 3dd2a5c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 30 deletions.
20 changes: 1 addition & 19 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
Metrics/AbcSize:
Enabled: false

Metrics/BlockNesting:
Max: 2

Expand All @@ -10,7 +7,7 @@ Metrics/LineLength:

Metrics/MethodLength:
CountComments: false
Max: 15
Max: 14

Metrics/ModuleLength:
Max: 150 # TODO: Lower to 100
Expand All @@ -32,27 +29,12 @@ Style/CollectionMethods:
Style/Documentation:
Enabled: false

Style/DotPosition:
EnforcedStyle: trailing

Style/DoubleNegation:
Enabled: false

Style/EachWithObject:
Enabled: false

Style/Encoding:
Enabled: false

Style/HashSyntax:
EnforcedStyle: hash_rockets

Style/Lambda:
Enabled: false

Style/RaiseArgs:
EnforcedStyle: compact

Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space

Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def credentials?
def validate_credentials!
credentials.each do |credential, value|
next if value.nil? || value == true || value == false || value.is_a?(String)
fail(Twitter::Error::ConfigurationError.new("Invalid #{credential} specified: #{value.inspect} must be a String."))
fail(Twitter::Error::ConfigurationError, "Invalid #{credential} specified: #{value.inspect} must be a String.")
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/twitter/media/video.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ class Video < Twitter::Identity
#
# @return [Array<Twitter::Size>]
def sizes
@attrs.fetch(:sizes, []).inject({}) do |object, (key, value)|
@attrs.fetch(:sizes, []).each_with_object({}) do |(key, value), object|
object[key] = Size.new(value)
object
end
end
memoize :sizes
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/null_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def respond_to?(*)
end

def instance_of?(klass)
fail(TypeError.new('class or module required')) unless klass.is_a?(Class)
fail(TypeError, 'class or module required') unless klass.is_a?(Class)
self.class == klass
end

def kind_of?(mod)
fail(TypeError.new('class or module required')) unless mod.is_a?(Module)
fail(TypeError, 'class or module required') unless mod.is_a?(Module)
self.class.ancestors.include?(mod)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/lists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def list_from_response_with_users(path, args)
# @param hash [Hash]
# @param list [Integer, String, URI, Twitter::List] A Twitter list ID, slug, URI, or object.
# @return [Hash]
def merge_list!(hash, list) # rubocop:disable MethodLength
def merge_list!(hash, list) # rubocop:disable AbcSize, MethodLength
case list
when Integer
hash[:list_id] = list
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Media
# @param media [File, Hash] A File object with your picture (PNG, JPEG or GIF)
# @param options [Hash] A customizable set of options.
def upload(media, options = {})
fail(Twitter::Error::UnacceptableIO.new) unless media.respond_to?(:to_io)
fail(Twitter::Error::UnacceptableIO) unless media.respond_to?(:to_io)
url = 'https://upload.twitter.com/1.1/media/upload.json'
headers = Twitter::Headers.new(self, :post, url, options).request_headers
HTTP.with(headers).post(url, :form => options).parse['media_id']
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/rest/tweets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def retweet!(*args)
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::PlacesAndGeo#reverse_geocode}.
# @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def update_with_media(status, media, options = {})
fail(Twitter::Error::UnacceptableIO.new) unless media.respond_to?(:to_io)
def update_with_media(status, media, options = {}) # rubocop:disable AbcSize
fail(Twitter::Error::UnacceptableIO) unless media.respond_to?(:to_io)
hash = options.dup
hash[:in_reply_to_status_id] = hash.delete(:in_reply_to_status).id unless hash[:in_reply_to_status].nil?
hash[:place_id] = hash.delete(:place).woeid unless hash[:place].nil?
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/streaming/message_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module Twitter
module Streaming
class MessageParser
def self.parse(data) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
def self.parse(data) # rubocop:disable AbcSize, CyclomaticComplexity, PerceivedComplexity
if data[:id]
Tweet.new(data)
elsif data[:event]
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/streaming/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def <<(data)

def on_headers_complete(_headers)
error = Twitter::Error.errors[@parser.status_code]
fail error.new if error
fail error if error
end

def on_body(data)
Expand Down

0 comments on commit 3dd2a5c

Please sign in to comment.