easypost 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b93e828aba22bcf673243120c7d51ab0d5bc813828204c5045ee7cbf4526bad2
4
- data.tar.gz: 904d0537ad8f78924dee006329b59a1b07ce3496c33d07149684ec4219547978
3
+ metadata.gz: 74cc993ead7c401dc7dbd719667872b1317a83e31c93bf85e3489cdc5b322a51
4
+ data.tar.gz: 17095956ef150f649b12b9b974db4098b495bbfe7710fe368d594e7e6410e6ea
5
5
  SHA512:
6
- metadata.gz: 64bbae9d00138cfc8634bb12a2d07b96dbfc951a93c2c983fa4a7da77e49bfc3d5ae2471ebca3ec84a5cb7c74fa88a1b851998c799119c071200bc37cd0645eb
7
- data.tar.gz: 1d6910376670da796ee8daf8ed7c54e54591cd7f0770b7d363a38bd9d406a229e1df364fa7c16aa0f688830e171be82cb0ddb2f2331dd125a980158fad8d23c1
6
+ metadata.gz: 8708b3ed757fdcec975e84a585bbbdc5e428de0f32b34b047b3d1860fb663db7b48748a49a5841de405adb00bc3102c3bc7ffea56d7d4ff0bf7ff6a74e81015d
7
+ data.tar.gz: 4fb43956853af9c440f7b84a804250e5e817ea3261e9900f821236bf2ae4fc623d1a68a36a899628b655ca6b1833e9095b3b943d2224224a95af24fb6c732bca
@@ -44,10 +44,10 @@ jobs:
44
44
  bundler-cache: true
45
45
  - name: Install Dependencies
46
46
  run: make install
47
+ - name: Install style guides
48
+ run: make install-styleguide
47
49
  - name: Lint Project
48
50
  run: make lint
49
- - name: Run security analysis
50
- run: make scan
51
51
  docs:
52
52
  if: github.ref == 'refs/heads/master'
53
53
  runs-on: ubuntu-latest
data/.gitignore CHANGED
@@ -24,3 +24,16 @@ test/tmp
24
24
  test/version_tmp
25
25
  tmp
26
26
  vendor/
27
+ /easycop.yml
28
+ /.rubocop.yml
29
+ [._]*.s[a-v][a-z]
30
+ [._]*.sw[a-p]
31
+ [._]s[a-rt-v][a-z]
32
+ [._]ss[a-gi-z]
33
+ [._]sw[a-p]
34
+ Session.vim
35
+ Sessionx.vim
36
+ .netrwhist
37
+ *~
38
+ tags
39
+ [._]*.un~
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v5.1.0 (2023-07-28)
4
+
5
+ - Adds hooks to introspect the request and response of API calls (see `HTTP Hooks` section in the README for more details)
6
+ - Maps 400 status code responses to the new `BadRequestError` class
7
+
8
+ ## v5.0.1 (2023-06-20)
9
+
10
+ - Fixes a bug where the params of a `customs_info` on create weren't wrapped properly which led to an empty set of `customs_items`
11
+
3
12
  ## v5.0.0 (2023-06-06)
4
13
 
5
14
  See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-4x-to-50) for more details.
data/Makefile CHANGED
@@ -20,19 +20,19 @@ coverage:
20
20
  docs:
21
21
  bundle exec rdoc lib -o docs --title "EasyPost Ruby Docs"
22
22
 
23
- ## fix - Fix Rubocop errors
24
- fix:
25
- bundle exec rubocop -a
23
+ ## install-styleguide - Import the style guides (Unix only)
24
+ install-styleguide: | update-examples-submodule
25
+ sh examples/symlink_directory_files.sh examples/style_guides/ruby .
26
26
 
27
27
  ## install - Install globally from source
28
- install:
29
- git submodule init
30
- git submodule update
28
+ install: | update-examples-submodule
31
29
  bundle install
32
30
 
33
31
  ## lint - Lint the project
34
- lint:
35
- bundle exec rubocop
32
+ lint: rubocop scan
33
+
34
+ ## lint-fix - Fix Rubocop errors
35
+ lint-fix: rubocop-fix
36
36
 
37
37
  ## publish - Publishes the built gem to Rubygems
38
38
  publish:
@@ -43,6 +43,14 @@ publish:
43
43
  release:
44
44
  gh release create ${tag} dist/*
45
45
 
46
+ ## rubocop - lints the project with rubocop
47
+ rubocop:
48
+ bundle exec rubocop
49
+
50
+ ## rubocop-fix - fix rubocop errors
51
+ rubocop-fix:
52
+ bundle exec rubocop -a
53
+
46
54
  ## scan - Runs security analysis on the project with Brakeman
47
55
  scan:
48
56
  bundle exec brakeman lib --force
@@ -52,8 +60,11 @@ test:
52
60
  bundle exec rspec
53
61
 
54
62
  ## update - Updates dependencies
55
- update:
63
+ update: | update-examples-submodule
64
+
65
+ ## update-examples-submodule - Update the examples submodule
66
+ update-examples-submodule:
56
67
  git submodule init
57
68
  git submodule update --remote
58
69
 
59
- .PHONY: help build clean coverage docs fix install lint publish release scan test update
70
+ .PHONY: help build clean coverage docs install install-styleguide lint lint-fix publish release rubocop rubocop-fix scan test update update-examples-submodule
data/README.md CHANGED
@@ -61,6 +61,7 @@ puts bought_shipment
61
61
  ### Custom Connections
62
62
 
63
63
  Pass in a lambda function as `custom_client_exec` when initializing a client that responds to `call(method, uri, headers, open_timeout, read_timeout, body = nil)` where:
64
+
64
65
  - `uri` is the fully-qualified URL of the EasyPost endpoint, including query parameters (`Uri` object)
65
66
  - `method` is the lowercase name of the HTTP method being used for the request (e.g. `:get`, `:post`, `:put`, `:delete`)
66
67
  - `headers` is a hash with all headers needed for the request pre-populated, including authorization (`Hash` object)
@@ -69,7 +70,8 @@ Pass in a lambda function as `custom_client_exec` when initializing a client tha
69
70
  - `body` is a string of the body data to be included in the request, or nil (e.g. GET or DELETE request) (string or `nil`)
70
71
 
71
72
  The lambda function should return an object with `code` and `body` attributes, where:
72
- - `code` is the HTTP response status code (integer)
73
+
74
+ - `code` is the HTTP response status code (integer)
73
75
  - `body` is the response body (string)
74
76
 
75
77
  #### Faraday
@@ -116,6 +118,49 @@ my_client = described_class.new(
116
118
  )
117
119
  ```
118
120
 
121
+ ### HTTP Hooks
122
+
123
+ Users can audit HTTP requests and responses being made by the library by subscribing to request and response events. To do so, pass a block to the `subscribe_request_hook` and `subscribe_response_hook` methods of an instance of `EasyPost::Client`:
124
+
125
+ ```ruby
126
+ require 'easypost'
127
+
128
+ client = EasyPost::Client.new(api_key: ENV['EASYPOST_API_KEY'])
129
+
130
+ # Returns a randomly-generated symbol which you can use to later unsubscribe the request hook
131
+ client.subscribe_request_hook do |request_data|
132
+ # Your code goes here
133
+ end
134
+ # Returns a randomly-generated symbol which you can use to later unsubscribe the response hook
135
+ client.subscribe_response_hook do |response_data|
136
+ # Your code goes here
137
+ end
138
+ ```
139
+
140
+ You can also name your hook subscriptions by providing an optional parameter to the methods above:
141
+
142
+ ```ruby
143
+ require 'easypost'
144
+
145
+ client = EasyPost::Client.new(api_key: ENV['EASYPOST_API_KEY'])
146
+
147
+ request_hook = client.subscribe_request_hook(:my_request_hook) do |request_data|
148
+ # Your code goes here
149
+ end
150
+ response_hook = client.subscribe_response_hook(:my_response_hook) do |response_data|
151
+ # Your code goes here
152
+ end
153
+
154
+ puts request_hook # :my_request_hook
155
+ puts response_hook # :my_response_hook
156
+ ```
157
+
158
+ Keep in mind that subscribing a hook with the same name of an existing hook will replace the existing hook with the new one. A request hook and a response hook can share the same name.
159
+
160
+ #### Custom HTTP Connections with HTTP Hooks
161
+
162
+ If you're using a custom HTTP connection, keep in mind that the `response_data` parameter that a response hook receives *will not be hydrated* with all the response data. You will have to inspect the `client_response_object` property in `response_data` to inspect the response code, response headers and response body.
163
+
119
164
  ## Documentation
120
165
 
121
166
  API documentation can be found at: <https://easypost.com/docs/api>.
@@ -136,11 +181,12 @@ For additional support, see our [org-wide support policy](https://github.com/Eas
136
181
  # Install dependencies
137
182
  make install
138
183
 
184
+ # Install style guide (Unix only)
185
+ make install-style
186
+
139
187
  # Lint project
140
188
  make lint
141
-
142
- # Fix linting errors
143
- make fix
189
+ make lint-fix
144
190
 
145
191
  # Run tests (coverage is generated on a successful test suite run)
146
192
  EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make test
@@ -152,8 +198,7 @@ make scan
152
198
  make docs
153
199
 
154
200
  # Update submodules
155
- git submodule init
156
- git submodule update --remote
201
+ make update-examples-submodule
157
202
  ```
158
203
 
159
204
  ### Testing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.0
1
+ 5.1.0
@@ -4,6 +4,7 @@ require_relative 'services'
4
4
  require_relative 'http_client'
5
5
  require_relative 'internal_utilities'
6
6
  require 'json'
7
+ require 'securerandom'
7
8
 
8
9
  class EasyPost::Client
9
10
  attr_reader :open_timeout, :read_timeout, :api_base
@@ -90,6 +91,54 @@ class EasyPost::Client
90
91
  EasyPost::InternalUtilities::Json.convert_json_to_object(response.body, cls)
91
92
  end
92
93
 
94
+ # Subscribe a request hook
95
+ #
96
+ # @param name [Symbol] the name of the hook. Defaults ot a ranom hexadecimal-based symbol
97
+ # @param block [Block] a code block that will be executed before a request is made
98
+ # @return [Symbol] the name of the request hook
99
+ def subscribe_request_hook(name = SecureRandom.hex.to_sym, &block)
100
+ EasyPost::Hooks.subscribe(:request, name, block)
101
+ end
102
+
103
+ # Unsubscribe a request hook
104
+ #
105
+ # @param name [Symbol] the name of the hook
106
+ # @return [Block] the hook code block
107
+ def unsubscribe_request_hook(name)
108
+ EasyPost::Hooks.unsubscribe(:request, name)
109
+ end
110
+
111
+ # Unsubscribe all request hooks
112
+ #
113
+ # @return [Hash] a hash containing all request hook subscriptions
114
+ def unsubscribe_all_request_hooks
115
+ EasyPost::Hooks.unsubscribe_all(:request)
116
+ end
117
+
118
+ # Subscribe a response hook
119
+ #
120
+ # @param name [Symbol] the name of the hook. Defaults ot a ranom hexadecimal-based symbol
121
+ # @param block [Block] a code block that will be executed upon receiving the response from a request
122
+ # @return [Symbol] the name of the response hook
123
+ def subscribe_response_hook(name = SecureRandom.hex.to_sym, &block)
124
+ EasyPost::Hooks.subscribe(:response, name, block)
125
+ end
126
+
127
+ # Unsubscribe a response hook
128
+ #
129
+ # @param name [Symbol] the name of the hook
130
+ # @return [Block] the hook code block
131
+ def unsubscribe_response_hook(name)
132
+ EasyPost::Hooks.unsubscribe(:response, name)
133
+ end
134
+
135
+ # Unsubscribe all response hooks
136
+ #
137
+ # @return [Hash] a hash containing all response hook subscriptions
138
+ def unsubscribe_all_response_hooks
139
+ EasyPost::Hooks.unsubscribe_all(:response)
140
+ end
141
+
93
142
  private
94
143
 
95
144
  def http_config
@@ -77,6 +77,8 @@ class EasyPost::Errors::ApiError < EasyPost::Errors::EasyPostError
77
77
  EasyPost::Errors::ConnectionError
78
78
  when 300, 301, 302, 303, 304, 305, 306, 307, 308
79
79
  EasyPost::Errors::RedirectError
80
+ when 400
81
+ EasyPost::Errors::BadRequestError
80
82
  when 401
81
83
  EasyPost::Errors::UnauthorizedError
82
84
  when 402
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api_error'
4
+
5
+ class EasyPost::Errors::BadRequestError < EasyPost::Errors::ApiError
6
+ end
@@ -12,6 +12,7 @@ require_relative 'errors/invalid_parameter_error'
12
12
  require_relative 'errors/missing_parameter_error'
13
13
  require_relative 'errors/signature_verification_error'
14
14
  require_relative 'errors/api/api_error'
15
+ require_relative 'errors/api/bad_request_error'
15
16
  require_relative 'errors/api/connection_error'
16
17
  require_relative 'errors/api/forbidden_error'
17
18
  require_relative 'errors/api/gateway_timeout_error'
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EasyPost::Hooks::RequestContext
4
+ attr_reader :method, :path, :headers, :request_body, :request_timestamp, :request_uuid
5
+
6
+ def initialize(method:, path:, headers:, request_body:, request_timestamp:, request_uuid:)
7
+ @method = method
8
+ @path = path
9
+ @headers = headers
10
+ @request_body = request_body
11
+ @request_timestamp = request_timestamp
12
+ @request_uuid = request_uuid
13
+
14
+ freeze
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EasyPost::Hooks::ResponseContext
4
+ attr_reader :http_status, :method, :path, :headers, :response_body,
5
+ :request_timestamp, :response_timestamp, :request_uuid,
6
+ :client_response_object
7
+
8
+ def initialize(http_status:, method:, path:, headers:, response_body:,
9
+ request_timestamp:, response_timestamp:, request_uuid:,
10
+ client_response_object:)
11
+ @http_status = http_status
12
+ @method = method
13
+ @path = path
14
+ @headers = headers
15
+ @response_body = response_body
16
+ @request_timestamp = request_timestamp
17
+ @response_timestamp = response_timestamp
18
+ @request_uuid = request_uuid
19
+ @client_response_object = client_response_object
20
+
21
+ freeze
22
+ end
23
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EasyPost::Hooks
4
+ def self.subscribe(type, name, block)
5
+ subscribers[type][name] = block
6
+
7
+ name
8
+ end
9
+
10
+ def self.unsubscribe(type, name)
11
+ subscribers[type].delete(name)
12
+ end
13
+
14
+ def self.unsubscribe_all(type)
15
+ subscribers.delete(type)
16
+ end
17
+
18
+ def self.notify(type, context)
19
+ subscribers[type].each_value { |subscriber| subscriber.call(context) }
20
+ end
21
+
22
+ def self.any_subscribers?(type)
23
+ !subscribers[type].empty?
24
+ end
25
+
26
+ def self.subscribers
27
+ @subscribers ||= Hash.new { |hash, key| hash[key] = {} }
28
+ end
29
+
30
+ private_class_method :subscribers
31
+ end
32
+
33
+ require_relative 'hooks/request_context'
34
+ require_relative 'hooks/response_context'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'securerandom'
4
+
3
5
  class EasyPost::HttpClient
4
6
  def initialize(base_url, config, custom_client_exec = nil)
5
7
  @base_url = base_url
@@ -20,17 +22,67 @@ class EasyPost::HttpClient
20
22
 
21
23
  uri = URI.parse("#{@base_url}/#{api_version}/#{path}")
22
24
  headers = @config[:headers].merge(headers || {})
23
- body = JSON.dump(EasyPost::InternalUtilities.objects_to_ids(body)) if body
25
+ serialized_body = JSON.dump(EasyPost::InternalUtilities.objects_to_ids(body)) if body
24
26
  open_timeout = @config[:open_timeout]
25
27
  read_timeout = @config[:read_timeout]
28
+ request_timestamp = Time.now
29
+ request_uuid = SecureRandom.uuid
30
+
31
+ if EasyPost::Hooks.any_subscribers?(:request)
32
+ request_context = EasyPost::Hooks::RequestContext.new(
33
+ method: method,
34
+ path: uri.to_s,
35
+ headers: headers,
36
+ request_body: body,
37
+ request_timestamp: request_timestamp,
38
+ request_uuid: request_uuid,
39
+ )
40
+ EasyPost::Hooks.notify(:request, request_context)
41
+ end
26
42
 
27
43
  # Execute the request, return the response.
28
44
 
29
- if @custom_client_exec
30
- @custom_client_exec.call(method, uri, headers, open_timeout, read_timeout, body)
31
- else
32
- default_request_execute(method, uri, headers, open_timeout, read_timeout, body)
45
+ response = if @custom_client_exec
46
+ @custom_client_exec.call(method, uri, headers, open_timeout, read_timeout, serialized_body)
47
+ else
48
+ default_request_execute(method, uri, headers, open_timeout, read_timeout, serialized_body)
49
+ end
50
+ response_timestamp = Time.now
51
+
52
+ if EasyPost::Hooks.any_subscribers?(:response)
53
+ response_context = {
54
+ http_status: nil,
55
+ method: method,
56
+ path: uri.to_s,
57
+ headers: nil,
58
+ response_body: nil,
59
+ request_timestamp: request_timestamp,
60
+ response_timestamp: response_timestamp,
61
+ client_response_object: response,
62
+ request_uuid: request_uuid,
63
+ }
64
+
65
+ # If using a custom HTTP client, the user will have to infer these from the raw
66
+ # client_response_object attribute
67
+ if response.is_a?(Net::HTTPResponse)
68
+ response_body = begin
69
+ JSON.parse(response.body)
70
+ rescue JSON::ParseError
71
+ response.body
72
+ end
73
+ response_context.merge!(
74
+ {
75
+ http_status: response.code.to_i,
76
+ headers: response.each_header.to_h,
77
+ response_body: response_body,
78
+ },
79
+ )
80
+ end
81
+
82
+ EasyPost::Hooks.notify(:response, EasyPost::Hooks::ResponseContext.new(**response_context))
33
83
  end
84
+
85
+ response
34
86
  end
35
87
 
36
88
  def default_request_execute(method, uri, headers, open_timeout, read_timeout, body = nil)
@@ -43,7 +95,10 @@ class EasyPost::HttpClient
43
95
  # Attempt to make the request and return the response.
44
96
  Net::HTTP.start(
45
97
  uri.host,
46
- uri.port, use_ssl: true, read_timeout: read_timeout, open_timeout: open_timeout,
98
+ uri.port,
99
+ use_ssl: true,
100
+ read_timeout: read_timeout,
101
+ open_timeout: open_timeout,
47
102
  ) do |http|
48
103
  http.request(request)
49
104
  end
@@ -5,7 +5,9 @@ class EasyPost::Services::CustomsInfo < EasyPost::Services::Service
5
5
 
6
6
  # Create a CustomsInfo object
7
7
  def create(params)
8
- @client.make_request(:post, 'customs_infos', MODEL_CLASS, params)
8
+ wrapped_params = { customs_info: params }
9
+
10
+ @client.make_request(:post, 'customs_infos', MODEL_CLASS, wrapped_params)
9
11
  end
10
12
 
11
13
  # Retrieve a CustomsInfo object
data/lib/easypost.rb CHANGED
@@ -24,5 +24,8 @@ require 'easypost/errors'
24
24
  # Internal Utilities
25
25
  require 'easypost/internal_utilities'
26
26
 
27
+ # Hooks
28
+ require 'easypost/hooks'
29
+
27
30
  module EasyPost
28
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easypost
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - EasyPost Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-06 00:00:00.000000000 Z
11
+ date: 2023-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brakeman
@@ -221,7 +221,6 @@ files:
221
221
  - ".github/workflows/ci.yml"
222
222
  - ".gitignore"
223
223
  - ".gitmodules"
224
- - ".rubocop.yml"
225
224
  - CHANGELOG.md
226
225
  - Gemfile
227
226
  - LICENSE
@@ -231,7 +230,6 @@ files:
231
230
  - UPGRADE_GUIDE.md
232
231
  - VERSION
233
232
  - bin/easypost-irb
234
- - easycop.yml
235
233
  - easypost.gemspec
236
234
  - lib/easypost.rb
237
235
  - lib/easypost/client.rb
@@ -239,6 +237,7 @@ files:
239
237
  - lib/easypost/constants.rb
240
238
  - lib/easypost/errors.rb
241
239
  - lib/easypost/errors/api/api_error.rb
240
+ - lib/easypost/errors/api/bad_request_error.rb
242
241
  - lib/easypost/errors/api/connection_error.rb
243
242
  - lib/easypost/errors/api/external_api_error.rb
244
243
  - lib/easypost/errors/api/forbidden_error.rb
@@ -264,6 +263,9 @@ files:
264
263
  - lib/easypost/errors/invalid_parameter_error.rb
265
264
  - lib/easypost/errors/missing_parameter_error.rb
266
265
  - lib/easypost/errors/signature_verification_error.rb
266
+ - lib/easypost/hooks.rb
267
+ - lib/easypost/hooks/request_context.rb
268
+ - lib/easypost/hooks/response_context.rb
267
269
  - lib/easypost/http_client.rb
268
270
  - lib/easypost/internal_utilities.rb
269
271
  - lib/easypost/models.rb
data/.rubocop.yml DELETED
@@ -1,16 +0,0 @@
1
- inherit_from: easycop.yml
2
-
3
- AllCops:
4
- SuggestExtensions: false
5
- Exclude:
6
- - bin/**/*
7
- - docs/**/*
8
- - examples/**/*
9
- - vendor/bundle/**/*
10
- # We are ignoring RSpec/FilePath because Simplecov doesn't play nice with nested spec files
11
- RSpec/FilePath:
12
- Enabled: false
13
- # TODO: Remove this once we start using keyword arguments
14
- Style/OptionalBooleanParameter:
15
- Exclude:
16
- - 'lib/easypost/services/*.rb'
data/easycop.yml DELETED
@@ -1,180 +0,0 @@
1
- # This file was generated by
2
- # `rake easycop:init`
3
- # on 2019-12-16 19:20:52 +0000 using EasyCop version 0.1.
4
- ---
5
- require:
6
- - rubocop-rspec
7
- AllCops:
8
- TargetRubyVersion: 2.6
9
- NewCops: disable
10
- Layout/BlockAlignment:
11
- Enabled: true
12
- EnforcedStyleAlignWith: start_of_block
13
- Layout/DotPosition:
14
- Enabled: true
15
- AutoCorrect: true
16
- EnforcedStyle: leading
17
- Layout/EmptyLineAfterGuardClause:
18
- Enabled: true
19
- AutoCorrect: true
20
- Layout/EmptyLinesAroundArguments:
21
- Enabled: true
22
- AutoCorrect: true
23
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
24
- Enabled: true
25
- AutoCorrect: true
26
- Layout/EndAlignment:
27
- Enabled: true
28
- EnforcedStyleAlignWith: keyword
29
- AutoCorrect: true
30
- Layout/MultilineMethodCallBraceLayout:
31
- EnforcedStyle: new_line
32
- Layout/MultilineHashBraceLayout:
33
- EnforcedStyle: new_line
34
- Layout/MultilineArrayBraceLayout:
35
- EnforcedStyle: new_line
36
- Layout/FirstArrayElementLineBreak:
37
- Enabled: true
38
- Layout/FirstHashElementLineBreak:
39
- Enabled: true
40
- Layout/FirstMethodArgumentLineBreak:
41
- Enabled: true
42
- Layout/LineLength:
43
- Max: 120
44
- AllowedPatterns:
45
- - "(\\A|\\s)#"
46
- Layout/LineEndStringConcatenationIndentation: # new in 1.18
47
- Enabled: true
48
- Layout/SpaceBeforeBrackets: # new in 1.7
49
- Enabled: true
50
- RSpec/SharedExamples:
51
- Enabled: false
52
- RSpec/NestedGroups:
53
- Enabled: false
54
- RSpec/ExampleLength:
55
- Enabled: false
56
- RSpec/ImplicitSubject:
57
- Enabled: false
58
- RSpec/MultipleExpectations:
59
- Enabled: false
60
- RSpec/MultipleMemoizedHelpers:
61
- Enabled: false
62
- RSpec/IdenticalEqualityAssertion: # new in 2.4
63
- Enabled: true
64
- Style/BlockDelimiters:
65
- Enabled: true
66
- EnforcedStyle: braces_for_chaining
67
- Style/ClassAndModuleChildren:
68
- Enabled: true
69
- EnforcedStyle: compact
70
- Style/Documentation:
71
- Enabled: false
72
- Style/MethodCalledOnDoEndBlock:
73
- Severity: warning
74
- Enabled: true
75
- Style/RaiseArgs:
76
- Enabled: false
77
- Style/RescueStandardError:
78
- Enabled: true
79
- Style/MultilineBlockChain:
80
- Enabled: false
81
- Style/TrailingCommaInHashLiteral:
82
- EnforcedStyleForMultiline: consistent_comma
83
- Style/TrailingCommaInArguments:
84
- EnforcedStyleForMultiline: consistent_comma
85
- Style/TrailingCommaInArrayLiteral:
86
- EnforcedStyleForMultiline: consistent_comma
87
- Style/SymbolArray:
88
- Enabled: false
89
- Style/IfUnlessModifier:
90
- Enabled: false
91
- Metrics/BlockLength:
92
- Enabled: false
93
- Metrics/ClassLength:
94
- Enabled: false
95
- Metrics/CyclomaticComplexity:
96
- Enabled: false
97
- Metrics/PerceivedComplexity:
98
- Enabled: false
99
- Metrics/ModuleLength:
100
- Enabled: false
101
- Metrics/MethodLength:
102
- Enabled: false
103
- Metrics/ParameterLists:
104
- Enabled: false
105
- Metrics/AbcSize:
106
- Enabled: false
107
- Gemspec/DeprecatedAttributeAssignment:
108
- Enabled: true
109
- Lint/AmbiguousAssignment: # new in 1.7
110
- Enabled: true
111
- Lint/AmbiguousRange: # new in 1.19
112
- Enabled: true
113
- Lint/DeprecatedConstants: # new in 1.8
114
- Enabled: true
115
- Lint/DuplicateBranch: # new in 1.3
116
- Enabled: true
117
- Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
118
- Enabled: true
119
- Lint/EmptyBlock: # new in 1.1
120
- Enabled: true
121
- Lint/EmptyClass: # new in 1.3
122
- Enabled: true
123
- Lint/EmptyInPattern: # new in 1.16
124
- Enabled: true
125
- Lint/LambdaWithoutLiteralBlock: # new in 1.8
126
- Enabled: true
127
- Lint/NoReturnInBeginEndBlocks: # new in 1.2
128
- Enabled: true
129
- Lint/NumberedParameterAssignment: # new in 1.9
130
- Enabled: true
131
- Lint/OrAssignmentToConstant: # new in 1.9
132
- Enabled: true
133
- Lint/RedundantDirGlobSort: # new in 1.8
134
- Enabled: true
135
- Lint/SymbolConversion: # new in 1.9
136
- Enabled: true
137
- Lint/ToEnumArguments: # new in 1.1
138
- Enabled: true
139
- Lint/TripleQuotes: # new in 1.9
140
- Enabled: true
141
- Lint/UnexpectedBlockArity: # new in 1.5
142
- Enabled: true
143
- Lint/UnmodifiedReduceAccumulator: # new in 1.1
144
- Enabled: true
145
- Naming/InclusiveLanguage: # new in 1.18
146
- Enabled: true
147
- Style/ArgumentsForwarding: # new in 1.1
148
- Enabled: true
149
- Style/CollectionCompact: # new in 1.2
150
- Enabled: true
151
- Style/DocumentDynamicEvalDefinition: # new in 1.1
152
- Enabled: true
153
- Style/EndlessMethod: # new in 1.8
154
- Enabled: true
155
- Style/HashConversion: # new in 1.10
156
- Enabled: true
157
- Style/HashExcept: # new in 1.7
158
- Enabled: true
159
- Style/IfWithBooleanLiteralBranches: # new in 1.9
160
- Enabled: true
161
- Style/InPatternThen: # new in 1.16
162
- Enabled: true
163
- Style/MultilineInPatternThen: # new in 1.16
164
- Enabled: true
165
- Style/NegatedIfElseCondition: # new in 1.2
166
- Enabled: true
167
- Style/NilLambda: # new in 1.3
168
- Enabled: true
169
- Style/QuotedSymbols: # new in 1.16
170
- Enabled: true
171
- Style/RedundantArgument: # new in 1.4
172
- Enabled: true
173
- Style/RedundantSelfAssignmentBranch: # new in 1.19
174
- Enabled: true
175
- Style/StringChars: # new in 1.12
176
- Enabled: true
177
- Style/SwapValues: # new in 1.1
178
- Enabled: true
179
- RSpec/Rails/AvoidSetupHook: # new in 2.4
180
- Enabled: true