ezcater_rubocop 2.0.0.pre0 → 2.0.0.pre1

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: 25b91003c623532c7bfef151198086556d2cea77e615469397f80e7f012c0359
4
- data.tar.gz: 8ef8be0def6078e2410a5876df56e0a1f91d88508e3ff2aa4b7dfdf1aecb565f
3
+ metadata.gz: 44fc1c8b8dc328d61ecf1acaf0bdf156c595c28c01cde1e49a48ee2c7a88ca53
4
+ data.tar.gz: 9b281bdad5735b54f31282800286b1f6c15bd6b860e08ae7aff94edfe15c4be1
5
5
  SHA512:
6
- metadata.gz: 865378735794cbb0e60e0f6ff4ff84a50ae0b95c9db016bf5d237f5464049f2246b56b1a0932f1851e73f6797fe6c4ab11784df555d224f50f6bdf32ff956760
7
- data.tar.gz: 48b0a31fc611f52e9103f9e3f7168f02d7e44a4937bf3fda294af32abf1ec04b13defdebdb97413fe3c3586d720514b44f80f65e4bb1cfb04d791395c7b28e31
6
+ metadata.gz: 020605c98b8aeb9f2527dc08edb811eaeb446153ddf8e3d404e6febdd7d31831edeefc13c88c7612f462f983606fca9fe1a31dfcbe91d5f615d316ee673ff343
7
+ data.tar.gz: a7dde3fda9fe500707b215a431df6a4d31087978aa15fa1c930e5af8de3704ad5037862fe193d76fba132cd63e065a31a1e8de74355f4397155f473fd32aa4bf
@@ -7,24 +7,26 @@ This gem is moving onto its own [Semantic Versioning](https://semver.org/) schem
7
7
  Prior to v1.0.0 this gem was versioned based on the `MAJOR`.`MINOR` version of RuboCop. The first release of the ezcater_rubocop gem was `v0.49.0`.
8
8
 
9
9
  ## v2.0.0 (unreleased)
10
- - Update to `rubocop` v0.78.0, `rubocop-rspec` v1.37.1 and `rubocop-rails`.
10
+ - Update to `rubocop` v0.81.0, `rubocop-rspec` v1.38.1 and `rubocop-rails` v2.5.2.
11
11
  - This is being released as a major update because cops have been renamed so this is unlikely to be
12
12
  a drop-in replacement.
13
13
 
14
- ## v1.3.0 (Unreleased)
14
+ ## v1.4.1
15
+ - Correct a matching syntax issue with `Ezcater/RubyTimeout` so that it applies in the expected cases.
15
16
 
17
+ ## v1.4.0
18
+ - Add `Ezcater/RubyTimeout` cop.
19
+
20
+ ## v1.3.0
16
21
  - Add `Ezcater/GraphqlFieldsNaming` cop.
17
22
 
18
23
  ## v1.2.0
19
-
20
24
  - Add `Ezcater/RailsTopLevelSqlExecute` to replace `ActiveRecord::Base.connection.execute` with `execute` in `db/migrate/`.
21
25
 
22
26
  ## v1.1.1
23
-
24
27
  - Exclude `lib/tasks/` for `Ezcater/RailsEnv` and `Ezcater/DirectEnvCheck`.
25
28
 
26
29
  ## v1.1.0
27
-
28
30
  - Add `Ezcater/RailsEnv` cop.
29
31
  - Add `Ezcater/DirectEnvCheck` cop.
30
32
 
@@ -139,3 +139,20 @@ Style/TrailingCommaInArrayLiteral:
139
139
 
140
140
  Style/TrailingCommaInHashLiteral:
141
141
  EnforcedStyleForMultiline: consistent_comma
142
+
143
+ ### New Cops
144
+
145
+ Lint/RaiseException:
146
+ Enabled: true
147
+
148
+ Lint/StructNewOverride:
149
+ Enabled: true
150
+
151
+ Style/HashEachMethods:
152
+ Enabled: true
153
+
154
+ Style/HashTransformKeys:
155
+ Enabled: true
156
+
157
+ Style/HashTransformValues:
158
+ Enabled: true
@@ -51,3 +51,7 @@ Ezcater/StyleDig:
51
51
  Description: 'Recommend `dig` for deeply nested access.'
52
52
  Enabled: true
53
53
  AutoCorrect: false
54
+
55
+ Ezcater/RubyTimeout:
56
+ Description: 'Disallow use of `Timeout.timeout` because it is unsafe and can cause unexpected behavior.'
57
+ Enabled: true
@@ -48,10 +48,10 @@ Gem::Specification.new do |spec|
48
48
  spec.add_development_dependency "rake", "~> 12.3"
49
49
  spec.add_development_dependency "rspec", "~> 3.0"
50
50
  spec.add_development_dependency "rspec_junit_formatter"
51
- spec.add_development_dependency "simplecov"
51
+ spec.add_development_dependency "simplecov", "< 0.18.0"
52
52
 
53
53
  spec.add_runtime_dependency "parser", "!= 2.5.1.1"
54
- spec.add_runtime_dependency "rubocop", "~> 0.78.0"
55
- spec.add_runtime_dependency "rubocop-rails", "~> 2.4.1"
56
- spec.add_runtime_dependency "rubocop-rspec", "~> 1.37.1"
54
+ spec.add_runtime_dependency "rubocop", "~> 0.81.0"
55
+ spec.add_runtime_dependency "rubocop-rails", "~> 2.5.2"
56
+ spec.add_runtime_dependency "rubocop-rspec", "~> 1.38.1"
57
57
  end
@@ -19,6 +19,7 @@ require "rubocop/cop/ezcater/direct_env_check"
19
19
  require "rubocop/cop/ezcater/graphql_fields_naming"
20
20
  require "rubocop/cop/ezcater/rails_configuration"
21
21
  require "rubocop/cop/ezcater/rails_env"
22
+ require "rubocop/cop/ezcater/ruby_timeout"
22
23
  require "rubocop/cop/ezcater/rails_top_level_sql_execute"
23
24
  require "rubocop/cop/ezcater/require_gql_error_helpers"
24
25
  require "rubocop/cop/ezcater/rspec_match_ordered_array"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzcaterRubocop
4
- VERSION = "2.0.0.pre0"
4
+ VERSION = "2.0.0.pre1"
5
5
  end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Ezcater
6
+ # Don't use Timeout.timeout because it can cause transient errors
7
+ #
8
+ # @example
9
+ # # bad
10
+ # Timeout.timeout(5) do
11
+ # ...
12
+ # end
13
+ #
14
+ # # good
15
+ # expiry_time = Time.current + 5.seconds
16
+ # while Time.current < expiry_time
17
+ # ...
18
+ # end
19
+ #
20
+ class RubyTimeout < Cop
21
+ MSG = <<~END_MESSAGE.split("\n").join(" ")
22
+ `Timeout.timeout` is unsafe. Find an alternative to achieve the same goal.
23
+ Ex. Use the timeout capabilities of a networking library.
24
+ Ex. Iterate and check runtime after each iteration.
25
+ END_MESSAGE
26
+
27
+ def_node_matcher "timeout", <<-PATTERN
28
+ (send (const _ :Timeout) :timeout ...)
29
+ PATTERN
30
+
31
+ def on_send(node)
32
+ timeout(node) do
33
+ add_offense(node, location: :expression, message: MSG)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezcater_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre0
4
+ version: 2.0.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezCater, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-21 00:00:00.000000000 Z
11
+ date: 2020-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "<"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.18.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "<"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.18.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: parser
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -128,42 +128,42 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.78.0
131
+ version: 0.81.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.78.0
138
+ version: 0.81.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop-rails
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 2.4.1
145
+ version: 2.5.2
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 2.4.1
152
+ version: 2.5.2
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-rspec
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.37.1
159
+ version: 1.38.1
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.37.1
166
+ version: 1.38.1
167
167
  description: ezCater custom cops and shared configuration
168
168
  email:
169
169
  - engineering@ezcater.com
@@ -197,6 +197,7 @@ files:
197
197
  - lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb
198
198
  - lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb
199
199
  - lib/rubocop/cop/ezcater/rspec_require_http_status_matcher.rb
200
+ - lib/rubocop/cop/ezcater/ruby_timeout.rb
200
201
  - lib/rubocop/cop/ezcater/style_dig.rb
201
202
  - lib/rubocop/rspec/language/each_selector.rb
202
203
  homepage: https://github.com/ezcater/ezcater_rubocop
@@ -219,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
220
  - !ruby/object:Gem::Version
220
221
  version: 1.3.1
221
222
  requirements: []
222
- rubygems_version: 3.0.6
223
+ rubygems_version: 3.1.2
223
224
  signing_key:
224
225
  specification_version: 4
225
226
  summary: ezCater custom cops and shared configuration