Skip to content

Commit

Permalink
Fix Rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
iMacTia committed Dec 27, 2023
1 parent 38ad5e6 commit 41165bc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/faraday/connection.rb
Expand Up @@ -15,7 +15,7 @@ module Faraday
class Connection
# A Set of allowed HTTP verbs.
METHODS = Set.new %i[get post put delete head patch options trace]
USER_AGENT = "Faraday v#{VERSION}"
USER_AGENT = "Faraday v#{VERSION}".freeze

# @return [Hash] URI query unencoded key/value pairs.
attr_reader :params
Expand Down
2 changes: 1 addition & 1 deletion lib/faraday/encoders/nested_params_encoder.rb
Expand Up @@ -102,7 +102,7 @@ def decode(query)

protected

SUBKEYS_REGEX = /[^\[\]]+(?:\]?\[\])?/.freeze
SUBKEYS_REGEX = /[^\[\]]+(?:\]?\[\])?/

def decode_pair(key, value, context)
subkeys = key.scan(SUBKEYS_REGEX)
Expand Down
2 changes: 1 addition & 1 deletion lib/faraday/options/env.rb
Expand Up @@ -60,7 +60,7 @@ module Faraday
:reason_phrase, :response_body) do
const_set(:ContentLength, 'Content-Length')
const_set(:StatusesWithoutBody, Set.new([204, 304]))
const_set(:SuccessfulStatuses, (200..299).freeze)
const_set(:SuccessfulStatuses, (200..299))

# A Set of HTTP verbs that typically send a body. If no body is set for
# these requests, the Content-Length header is set to 0.
Expand Down
2 changes: 1 addition & 1 deletion lib/faraday/request/json.rb
Expand Up @@ -13,7 +13,7 @@ class Request
# Doesn't try to encode bodies that already are in string form.
class Json < Middleware
MIME_TYPE = 'application/json'
MIME_TYPE_REGEX = %r{^application/(vnd\..+\+)?json$}.freeze
MIME_TYPE_REGEX = %r{^application/(vnd\..+\+)?json$}

def on_request(env)
match_content_type(env) do |data|
Expand Down
4 changes: 2 additions & 2 deletions lib/faraday/response/raise_error.rb
Expand Up @@ -6,8 +6,8 @@ class Response
# client or server error responses.
class RaiseError < Middleware
# rubocop:disable Naming/ConstantName
ClientErrorStatuses = (400...500).freeze
ServerErrorStatuses = (500...600).freeze
ClientErrorStatuses = (400...500)
ServerErrorStatuses = (500...600)
# rubocop:enable Naming/ConstantName

def on_complete(env)
Expand Down
4 changes: 2 additions & 2 deletions lib/faraday/utils.rb
Expand Up @@ -25,7 +25,7 @@ class << self
attr_writer :default_space_encoding
end

ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/.freeze
ESCAPE_RE = /[^a-zA-Z0-9 .~_-]/

def escape(str)
str.to_s.gsub(ESCAPE_RE) do |match|
Expand All @@ -37,7 +37,7 @@ def unescape(str)
CGI.unescape str.to_s
end

DEFAULT_SEP = /[&;] */n.freeze
DEFAULT_SEP = /[&;] */n

# Adapted from Rack
def parse_query(query)
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Expand Up @@ -31,12 +31,12 @@

# Ensure all /lib files are loaded
# so they will be included in the test coverage report.
Dir['./lib/**/*.rb'].sort.each { |file| require file }
Dir['./lib/**/*.rb'].each { |file| require file }

require 'faraday'
require 'pry'

Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
Dir['./spec/support/**/*.rb'].each { |f| require f }

RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
Expand Down

0 comments on commit 41165bc

Please sign in to comment.