ezcater_rubocop 2.0.0.pre0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -6
- data/conf/rubocop.yml +25 -0
- data/conf/rubocop_gem.yml +1 -0
- data/conf/rubocop_rails.yml +5 -0
- data/config/default.yml +4 -0
- data/ezcater_rubocop.gemspec +7 -6
- data/lib/ezcater_rubocop.rb +1 -0
- data/lib/ezcater_rubocop/version.rb +1 -1
- data/lib/rubocop/cop/ezcater/ruby_timeout.rb +39 -0
- metadata +22 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be105a0d50d96f787a2dcface6a8850d0754c975a224489755a78107bd387a01
|
4
|
+
data.tar.gz: 263a7bde454086d6171fefede0684aa035b2564fe5ab7e56dd901cbc7379e925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae30e082ef82f070eeb11994a10f852e846590799ade95b3e85d87668386c41fe107dd81aa2bb688453dc8369b72ce044be59c231667ce8cf1a6bfe83fd4df27
|
7
|
+
data.tar.gz: 58fa9015aecefd84a3986203a98ff9c10edb1ec72658c2392ac88ba5a771997a4aa08477eb56a062063c24afddfd826285914e104b03bdda7455e9c55621004b
|
data/CHANGELOG.md
CHANGED
@@ -6,25 +6,35 @@ This gem is moving onto its own [Semantic Versioning](https://semver.org/) schem
|
|
6
6
|
|
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
|
-
## v2.
|
10
|
-
-
|
9
|
+
## v2.2.0
|
10
|
+
- Require Ruby 2.6 or later.
|
11
|
+
- Set `TargetRubyVersion` to 2.6 in `rubocop_gem` configuration.
|
12
|
+
|
13
|
+
## v2.1.0
|
14
|
+
- Enable `Rails/SaveBang` with `AllowImplicitReturn: false`, and with autocorrection disabled.
|
15
|
+
|
16
|
+
## v2.0.0
|
17
|
+
- Update to `rubocop` v0.81.0, `rubocop-rspec` v1.38.1 and `rubocop-rails` v2.5.2.
|
11
18
|
- This is being released as a major update because cops have been renamed so this is unlikely to be
|
12
19
|
a drop-in replacement.
|
20
|
+
- This is the first release to support Ruby 2.7.
|
21
|
+
|
22
|
+
## v1.4.1
|
23
|
+
- Correct a matching syntax issue with `Ezcater/RubyTimeout` so that it applies in the expected cases.
|
13
24
|
|
14
|
-
## v1.
|
25
|
+
## v1.4.0
|
26
|
+
- Add `Ezcater/RubyTimeout` cop.
|
15
27
|
|
28
|
+
## v1.3.0
|
16
29
|
- Add `Ezcater/GraphqlFieldsNaming` cop.
|
17
30
|
|
18
31
|
## v1.2.0
|
19
|
-
|
20
32
|
- Add `Ezcater/RailsTopLevelSqlExecute` to replace `ActiveRecord::Base.connection.execute` with `execute` in `db/migrate/`.
|
21
33
|
|
22
34
|
## v1.1.1
|
23
|
-
|
24
35
|
- Exclude `lib/tasks/` for `Ezcater/RailsEnv` and `Ezcater/DirectEnvCheck`.
|
25
36
|
|
26
37
|
## v1.1.0
|
27
|
-
|
28
38
|
- Add `Ezcater/RailsEnv` cop.
|
29
39
|
- Add `Ezcater/DirectEnvCheck` cop.
|
30
40
|
|
data/conf/rubocop.yml
CHANGED
@@ -139,3 +139,28 @@ Style/TrailingCommaInArrayLiteral:
|
|
139
139
|
|
140
140
|
Style/TrailingCommaInHashLiteral:
|
141
141
|
EnforcedStyleForMultiline: consistent_comma
|
142
|
+
|
143
|
+
### New Cops
|
144
|
+
|
145
|
+
# Cops are now introduced in a "pending" state and must be explicitly
|
146
|
+
# enabled or disabled. New cops are not enabled by default until the
|
147
|
+
# next major release.
|
148
|
+
|
149
|
+
#### New cops in v0.81
|
150
|
+
|
151
|
+
Lint/RaiseException:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
Lint/StructNewOverride:
|
155
|
+
Enabled: true
|
156
|
+
|
157
|
+
#### New cops in v0.80
|
158
|
+
|
159
|
+
Style/HashEachMethods:
|
160
|
+
Enabled: true
|
161
|
+
|
162
|
+
Style/HashTransformKeys:
|
163
|
+
Enabled: true
|
164
|
+
|
165
|
+
Style/HashTransformValues:
|
166
|
+
Enabled: true
|
data/conf/rubocop_gem.yml
CHANGED
data/conf/rubocop_rails.yml
CHANGED
@@ -47,6 +47,11 @@ Rails/UnknownEnv:
|
|
47
47
|
- staging
|
48
48
|
- production
|
49
49
|
|
50
|
+
Rails/SaveBang:
|
51
|
+
Enabled: true
|
52
|
+
AllowImplicitReturn: false
|
53
|
+
AutoCorrect: False
|
54
|
+
|
50
55
|
Ezcater/RailsTopLevelSqlExecute:
|
51
56
|
Description: 'Use `execute` instead of `ActiveRecord::Base.connection.execute` in migrations.'
|
52
57
|
Enabled: true
|
data/config/default.yml
CHANGED
@@ -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
|
data/ezcater_rubocop.gemspec
CHANGED
@@ -42,16 +42,17 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.executables << "circle_rubocop.rb"
|
43
43
|
spec.require_paths = ["lib"]
|
44
44
|
|
45
|
-
spec.
|
46
|
-
|
45
|
+
spec.required_ruby_version = ">= 2.6"
|
46
|
+
|
47
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
47
48
|
spec.add_development_dependency "pry-byebug"
|
48
49
|
spec.add_development_dependency "rake", "~> 12.3"
|
49
50
|
spec.add_development_dependency "rspec", "~> 3.0"
|
50
51
|
spec.add_development_dependency "rspec_junit_formatter"
|
51
|
-
spec.add_development_dependency "simplecov"
|
52
|
+
spec.add_development_dependency "simplecov", "< 0.18.0"
|
52
53
|
|
53
54
|
spec.add_runtime_dependency "parser", "!= 2.5.1.1"
|
54
|
-
spec.add_runtime_dependency "rubocop", "~> 0.
|
55
|
-
spec.add_runtime_dependency "rubocop-rails", "~> 2.
|
56
|
-
spec.add_runtime_dependency "rubocop-rspec", "~> 1.
|
55
|
+
spec.add_runtime_dependency "rubocop", "~> 0.81.0"
|
56
|
+
spec.add_runtime_dependency "rubocop-rails", "~> 2.5.2"
|
57
|
+
spec.add_runtime_dependency "rubocop-rspec", "~> 1.38.1"
|
57
58
|
end
|
data/lib/ezcater_rubocop.rb
CHANGED
@@ -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"
|
@@ -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.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: mry
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: '2.1'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: pry-byebug
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +84,16 @@ dependencies:
|
|
98
84
|
name: simplecov
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - "<"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
89
|
+
version: 0.18.0
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - "<"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
96
|
+
version: 0.18.0
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: parser
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,42 +114,42 @@ dependencies:
|
|
128
114
|
requirements:
|
129
115
|
- - "~>"
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
117
|
+
version: 0.81.0
|
132
118
|
type: :runtime
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
122
|
- - "~>"
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
124
|
+
version: 0.81.0
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: rubocop-rails
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
129
|
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.
|
131
|
+
version: 2.5.2
|
146
132
|
type: :runtime
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
136
|
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.
|
138
|
+
version: 2.5.2
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: rubocop-rspec
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
145
|
+
version: 1.38.1
|
160
146
|
type: :runtime
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
152
|
+
version: 1.38.1
|
167
153
|
description: ezCater custom cops and shared configuration
|
168
154
|
email:
|
169
155
|
- engineering@ezcater.com
|
@@ -197,6 +183,7 @@ files:
|
|
197
183
|
- lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb
|
198
184
|
- lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb
|
199
185
|
- lib/rubocop/cop/ezcater/rspec_require_http_status_matcher.rb
|
186
|
+
- lib/rubocop/cop/ezcater/ruby_timeout.rb
|
200
187
|
- lib/rubocop/cop/ezcater/style_dig.rb
|
201
188
|
- lib/rubocop/rspec/language/each_selector.rb
|
202
189
|
homepage: https://github.com/ezcater/ezcater_rubocop
|
@@ -204,7 +191,7 @@ licenses:
|
|
204
191
|
- MIT
|
205
192
|
metadata:
|
206
193
|
allowed_push_host: https://rubygems.org
|
207
|
-
post_install_message:
|
194
|
+
post_install_message:
|
208
195
|
rdoc_options: []
|
209
196
|
require_paths:
|
210
197
|
- lib
|
@@ -212,15 +199,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
199
|
requirements:
|
213
200
|
- - ">="
|
214
201
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
202
|
+
version: '2.6'
|
216
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
204
|
requirements:
|
218
|
-
- - "
|
205
|
+
- - ">="
|
219
206
|
- !ruby/object:Gem::Version
|
220
|
-
version:
|
207
|
+
version: '0'
|
221
208
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
223
|
-
signing_key:
|
209
|
+
rubygems_version: 3.1.6
|
210
|
+
signing_key:
|
224
211
|
specification_version: 4
|
225
212
|
summary: ezCater custom cops and shared configuration
|
226
213
|
test_files: []
|