ezcater_rubocop 9.0.0 → 10.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 337bff593d9c3f7c40060dadfa14b7539dd516b415099a032f0aaa3fa21cbc1a
4
- data.tar.gz: 476b7cad539b35fbc6c72b007c7d1f6f2ea018d5ee5362c025388970c9fd6c98
3
+ metadata.gz: 71c0339727c6e2f10a7feb608f5ddeeb1a6c1300fd10e2bffac5f930c60c1f16
4
+ data.tar.gz: 9493e102e561b4421bdf0251c2ea94340b29f663eec2b472c71de7f7945c1cad
5
5
  SHA512:
6
- metadata.gz: 0d549c1553f5c45af6736b5687a1d2bb3e5adbc93b48a104686b5cc398e9d659336f1004eacc740b913d7214a07685c45b087af3db018b0535d5e5a236f6ffed
7
- data.tar.gz: 432153e688f0fc386dfa4979c8443a96453f8a0f16d8be22a32683c98643e378854936084afa5f28ced2f36490396f79de853e822fad5e8d039e615a25d72e83
6
+ metadata.gz: 7f499de02f76fe35e019a2e1a7d417ecdbb52c5ae91ea947d3771870d7af3df5b4aefe107e52567101cf6cb6c8f36633e016951eca235320551430f2d37b0d94
7
+ data.tar.gz: b2d058f36bbabbff2658cbba0ec6a586c45c9fa5ac4ef80f898de8688353bd791a655cbb6014dce474ee47ca198fa1c3c885f2ae5d3b8acb464ffb51eb02ddd2
@@ -0,0 +1,23 @@
1
+ name: Release Gem
2
+ on: workflow_dispatch
3
+
4
+ jobs:
5
+ push:
6
+ name: Push gem to RubyGems.org
7
+ runs-on: ubuntu-latest
8
+
9
+ permissions:
10
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
11
+ contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
12
+
13
+ steps:
14
+ # Set up
15
+ - uses: actions/checkout@v4
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ bundler-cache: true
20
+ ruby-version: ruby
21
+
22
+ # Release
23
+ - uses: rubygems/release-gem@v1
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ 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
+ ## 10.1.0 (September 23, 2025)
10
+
11
+ - Update deprecated syntax `max` to `exclude_limit` for the `MultipleExpectations` rule.
12
+
13
+ ## 10.0.0 (August 20, 2025)
14
+
15
+ - Add `Ezcater/RspecNoResolveClassField` cop, which prevents using the deprecated GraphQL testing interface `resolve_class_field`.
16
+
9
17
  ## 9.0.0 (February 24, 2025)
10
18
 
11
19
  - Add support for `plugin` architecture in `rubocop >= 1.72.0` and `rubocop-rails >= 2.28.0`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ezcater_rubocop (9.0.0)
4
+ ezcater_rubocop (10.1.0)
5
5
  parser (>= 2.6)
6
6
  rubocop (>= 1.72.0, < 2.0)
7
7
  rubocop-graphql (>= 0.14.0, < 1.0)
@@ -36,7 +36,7 @@ GEM
36
36
  drb (2.2.1)
37
37
  i18n (1.14.7)
38
38
  concurrent-ruby (~> 1.0)
39
- json (2.10.1)
39
+ json (2.10.2)
40
40
  language_server-protocol (3.17.0.4)
41
41
  lint_roller (1.1.0)
42
42
  logger (1.6.6)
@@ -53,7 +53,7 @@ GEM
53
53
  byebug (~> 11.0)
54
54
  pry (>= 0.13, < 0.15)
55
55
  racc (1.8.1)
56
- rack (3.1.10)
56
+ rack (3.1.16)
57
57
  rainbow (3.1.1)
58
58
  rake (13.2.1)
59
59
  regexp_parser (2.10.0)
@@ -117,6 +117,7 @@ GEM
117
117
 
118
118
  PLATFORMS
119
119
  arm64-darwin-24
120
+ x86_64-linux
120
121
 
121
122
  DEPENDENCIES
122
123
  bundler
data/README.md CHANGED
@@ -92,6 +92,7 @@ not add cops with `enabled: false` unless you want that cop to always be disable
92
92
  * [RequireGqlErrorHelpers](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/require_gql_error_helpers.rb) - Use the helpers provided by `GQLErrors` instead of raising `GraphQL::ExecutionError` directly.
93
93
  * [RspecDotNotSelfDot](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb) - Enforce ".<class method>" instead of "self.<class method>" and "::<class method>" for example group description.
94
94
  * [RspecMatchOrderedArray](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_match_ordered_array.rb) - Enforce use of `match_ordered_array` matcher instead of `eq` matcher. This matcher comes from the [ezcater_matchers](https://github.com/ezcater/ezcater_matchers) gem.
95
+ * [RspecNoResolveClassField](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_no_resolve_class_field.rb) - Do not use deprecated GraphQL testing interface `resolve_class_field`.
95
96
  * [RspecRequireBrowserMock](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb) - Enforce use of `mock_ezcater_app`, `mock_chrome_browser` & `mock_custom_browser` helpers instead of mocking `Browser` or `EzBrowser` directly.
96
97
  * [RspecRequireFeatureFlagMock](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb) - Enforce use of `mock_feature_flag` helper instead of mocking `FeatureFlag.is_active?` directly.
97
98
  * [RspecRequireHttpStatusMatcher](https://github.com/ezcater/ezcater_rubocop/blob/main/lib/rubocop/cop/ezcater/rspec_require_http_status_matcher.rb) - Use the HTTP status code matcher, like `expect(response).to have_http_status :bad_request`, rather than `expect(response.code).to eq 400`
@@ -108,7 +109,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
108
109
 
109
110
  ### Releasing a New Version
110
111
 
111
- To release a new version, update the version number in `version.rb`, merge your PR to `main`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
112
+ To release a new version, update the version number in `version.rb`, merge your PR to `main`, and then manually run the "Release Gem" GitHub Action, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
112
113
 
113
114
  ## Contributing
114
115
 
data/conf/rubocop.yml CHANGED
@@ -85,7 +85,7 @@ RSpec/MessageExpectation:
85
85
  EnforcedStyle: allow
86
86
 
87
87
  RSpec/MultipleExpectations:
88
- Max: 5
88
+ exclude_limit: 5
89
89
 
90
90
  RSpec/NestedGroups:
91
91
  Max: 5
data/config/default.yml CHANGED
@@ -75,6 +75,12 @@ GraphQL/ExtractInputType:
75
75
  Exclude:
76
76
  - "**/input_objects/**/*.rb"
77
77
 
78
+ Ezcater/RspecNoResolveClassField:
79
+ Description: "Do not use `resolve_class_field` in spec files."
80
+ Enabled: true
81
+ Include:
82
+ - "**/*_spec.rb"
83
+
78
84
  Ezcater/Migration/BigintForeignKey:
79
85
  Description: "Use `bigint` instead of `integer` for all foreign keys."
80
86
  Include:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzcaterRubocop
4
- VERSION = "9.0.0"
4
+ VERSION = "10.1.0"
5
5
  end
@@ -31,5 +31,6 @@ require_relative "rubocop/cop/ezcater/rspec_require_browser_mock"
31
31
  require_relative "rubocop/cop/ezcater/rspec_require_feature_flag_mock"
32
32
  require_relative "rubocop/cop/ezcater/rspec_require_http_status_matcher"
33
33
  require_relative "rubocop/cop/ezcater/rspec_dot_not_self_dot"
34
+ require_relative "rubocop/cop/ezcater/rspec_no_resolve_class_field"
34
35
  require_relative "rubocop/cop/ezcater/style_dig"
35
36
  require_relative "rubocop/cop/ezcater/migration/bigint_foreign_key"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Ezcater
6
+ # Do not use `resolve_class_field`.
7
+ #
8
+ # @example
9
+ #
10
+ # # bad
11
+ # resolve_class_field(:user, :name)
12
+ # resolve_class_field(:user, [:name])
13
+ # obj.resolve_class_field(:user, :name)
14
+ #
15
+ # # good
16
+ # execute(EzrailsSchema, query, variables: { id: }, context: graphql_context)
17
+ #
18
+ # More information: https://engportal.ezcater.com/docs/default/component/dev-handbook/technology/graphql/backend_implementation/testing/#recommendation
19
+ #
20
+ class RspecNoResolveClassField < Base
21
+ MSG = "Do not use `resolve_class_field`. Use a query instead."
22
+
23
+ def_node_matcher :resolve_class_field_call?, <<~PATTERN
24
+ {
25
+ (send nil? :resolve_class_field ...)
26
+ (send _ :resolve_class_field ...)
27
+ }
28
+ PATTERN
29
+
30
+ def on_send(node)
31
+ return unless resolve_class_field_call?(node)
32
+
33
+ add_offense(node, message: MSG)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezcater_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.0
4
+ version: 10.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezCater, Inc
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -200,6 +199,7 @@ files:
200
199
  - ".github/PULL_REQUEST_TEMPLATE.md"
201
200
  - ".github/workflows/codeql.yml"
202
201
  - ".github/workflows/dependency-review.yml"
202
+ - ".github/workflows/release.yml"
203
203
  - ".tool-versions"
204
204
  - CHANGELOG.md
205
205
  - Gemfile
@@ -227,6 +227,7 @@ files:
227
227
  - lib/rubocop/cop/ezcater/require_gql_error_helpers.rb
228
228
  - lib/rubocop/cop/ezcater/rspec_dot_not_self_dot.rb
229
229
  - lib/rubocop/cop/ezcater/rspec_match_ordered_array.rb
230
+ - lib/rubocop/cop/ezcater/rspec_no_resolve_class_field.rb
230
231
  - lib/rubocop/cop/ezcater/rspec_require_browser_mock.rb
231
232
  - lib/rubocop/cop/ezcater/rspec_require_feature_flag_mock.rb
232
233
  - lib/rubocop/cop/ezcater/rspec_require_http_status_matcher.rb
@@ -238,7 +239,6 @@ licenses:
238
239
  - MIT
239
240
  metadata:
240
241
  allowed_push_host: https://rubygems.org
241
- post_install_message:
242
242
  rdoc_options: []
243
243
  require_paths:
244
244
  - lib
@@ -253,8 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  - !ruby/object:Gem::Version
254
254
  version: '0'
255
255
  requirements: []
256
- rubygems_version: 3.3.7
257
- signing_key:
256
+ rubygems_version: 3.6.9
258
257
  specification_version: 4
259
258
  summary: ezCater custom cops and shared configuration
260
259
  test_files: []