gitlab-styles 13.0.2 → 13.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: 1b05957f6a3353a50fe37009f0c78239677857f28e6d16589de5eb3aa8120868
4
- data.tar.gz: d3169d41ff1af9327b2e1e3a8fb2a5a2357915542ad0bb3352e52451e3cfb0dc
3
+ metadata.gz: 5e57fcdf2fdb535c445887ec28fe2c32809c24b90cf0202a27cf04f086c32fbc
4
+ data.tar.gz: '074834caba51bf818e60afdffe2260f644d270d065af3eb46dd256d6deb90d5c'
5
5
  SHA512:
6
- metadata.gz: 53891b9794f187eaa55f40dd87d2f89bbe84d4d7204fb40b40de4b7dc3761b2e4a265a670ed4255d49ef419df682a5d5e44d8283e12d01bf530be1a684527ba2
7
- data.tar.gz: d77ec1fb537c34c438527eb019c12bfff2f463bfd78212384f15e2cdd327e5de2cd9572d91d6020ef72f3c885bc4f5de244d5b9a1bc842d2aa0347b0bfb75fbd
6
+ metadata.gz: 60c696ef6dcde1baac7ff18ba02267f1d275182cf4ffa0bdfe400c7144ae8100bfc9f15e3faea4597e45afc3dd18e3445fda8b55ce1b9251ca57b985f682ab40
7
+ data.tar.gz: 980a9c08bf84a10dc151c188b66cc60d3e42a953aea058955ad65bc6d8ad32d7498f154ce74257b71a1ef620d58cd3ef1f28c0025f2547c17eb5b5be02e60bb8
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2024-09-06 09:55:51 UTC using RuboCop version 1.64.0.
2
+ # `rubocop --auto-gen-config --exclude-limit 10000`
3
+ # on 2025-02-02 02:50:28 UTC using RuboCop version 1.71.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -22,11 +22,6 @@ InternalAffairs/CopDescriptionWithExample:
22
22
  - 'lib/rubocop/cop/performance/rubyzip.rb'
23
23
  - 'lib/rubocop/cop/polymorphic_associations.rb'
24
24
 
25
- # Offense count: 1
26
- InternalAffairs/InheritDeprecatedCopClass:
27
- Exclude:
28
- - 'lib/rubocop/cop/gitlab_security/json_serialization.rb'
29
-
30
25
  # Offense count: 10
31
26
  InternalAffairs/MissingCopDepartment:
32
27
  Exclude:
@@ -40,3 +35,31 @@ InternalAffairs/MissingCopDepartment:
40
35
  - 'lib/rubocop/cop/line_break_around_conditional_block.rb'
41
36
  - 'lib/rubocop/cop/polymorphic_associations.rb'
42
37
  - 'lib/rubocop/cop/redirect_with_status.rb'
38
+
39
+ # Offense count: 24
40
+ InternalAffairs/OnSendWithoutOnCSend:
41
+ Exclude:
42
+ - 'lib/rubocop/cop/active_record_dependent.rb'
43
+ - 'lib/rubocop/cop/active_record_serialize.rb'
44
+ - 'lib/rubocop/cop/code_reuse/active_record.rb'
45
+ - 'lib/rubocop/cop/gem_fetcher.rb'
46
+ - 'lib/rubocop/cop/gitlab_security/deep_munge.rb'
47
+ - 'lib/rubocop/cop/gitlab_security/json_serialization.rb'
48
+ - 'lib/rubocop/cop/gitlab_security/redirect_to_params_update.rb'
49
+ - 'lib/rubocop/cop/gitlab_security/send_file_params.rb'
50
+ - 'lib/rubocop/cop/gitlab_security/sql_injection.rb'
51
+ - 'lib/rubocop/cop/gitlab_security/system_command_injection.rb'
52
+ - 'lib/rubocop/cop/in_batches.rb'
53
+ - 'lib/rubocop/cop/internal_affairs/deprecate_cop_helper.rb'
54
+ - 'lib/rubocop/cop/migration/update_large_table.rb'
55
+ - 'lib/rubocop/cop/performance/rubyzip.rb'
56
+ - 'lib/rubocop/cop/polymorphic_associations.rb'
57
+ - 'lib/rubocop/cop/rails/include_url_helper.rb'
58
+ - 'lib/rubocop/cop/redirect_with_status.rb'
59
+ - 'lib/rubocop/cop/rspec/have_link_parameters.rb'
60
+ - 'lib/rubocop/cop/rspec/rails_controller_testing.rb'
61
+ - 'lib/rubocop/cop/rspec/specify_expected.rb'
62
+ - 'lib/rubocop/cop/rspec/useless_dynamic_definition.rb'
63
+ - 'lib/rubocop/cop/rspec/verbose_include_metadata.rb'
64
+ - 'lib/rubocop/cop/style/hash_transformation.rb'
65
+ - 'lib/rubocop/cop/style/iso8601_date.rb'
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-styles (13.0.2)
5
- rubocop (~> 1.68.0)
4
+ gitlab-styles (13.1.0)
5
+ rubocop (= 1.71.1)
6
6
  rubocop-capybara (~> 2.21.0)
7
7
  rubocop-factory_bot (~> 2.26.1)
8
8
  rubocop-graphql (~> 1.5.4)
@@ -132,7 +132,7 @@ GEM
132
132
  rainbow (3.1.1)
133
133
  rake (13.0.6)
134
134
  rchardet (1.8.0)
135
- regexp_parser (2.9.2)
135
+ regexp_parser (2.10.0)
136
136
  rexml (3.2.8)
137
137
  strscan (>= 3.0.9)
138
138
  rspec (3.12.0)
@@ -156,17 +156,17 @@ GEM
156
156
  binding_of_caller
157
157
  rspec-parameterized-core (< 2)
158
158
  rspec-support (3.12.0)
159
- rubocop (1.68.0)
159
+ rubocop (1.71.1)
160
160
  json (~> 2.3)
161
161
  language_server-protocol (>= 3.17.0)
162
162
  parallel (~> 1.10)
163
163
  parser (>= 3.3.0.2)
164
164
  rainbow (>= 2.2.2, < 4.0)
165
- regexp_parser (>= 2.4, < 3.0)
166
- rubocop-ast (>= 1.32.2, < 2.0)
165
+ regexp_parser (>= 2.9.3, < 3.0)
166
+ rubocop-ast (>= 1.38.0, < 2.0)
167
167
  ruby-progressbar (~> 1.7)
168
- unicode-display_width (>= 2.4.0, < 3.0)
169
- rubocop-ast (1.32.3)
168
+ unicode-display_width (>= 2.4.0, < 4.0)
169
+ rubocop-ast (1.38.0)
170
170
  parser (>= 3.3.1.0)
171
171
  rubocop-capybara (2.21.0)
172
172
  rubocop (~> 1.41)
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'rubocop', '~> 1.68.0'
25
+ spec.add_dependency 'rubocop', '1.71.1'
26
26
  spec.add_dependency 'rubocop-capybara', '~> 2.21.0'
27
27
  spec.add_dependency 'rubocop-factory_bot', '~> 2.26.1'
28
28
  spec.add_dependency 'rubocop-graphql', '~> 1.5.4'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Styles
5
- VERSION = '13.0.2'
5
+ VERSION = '13.1.0'
6
6
  end
7
7
  end
@@ -67,7 +67,7 @@ module Rubocop
67
67
  end
68
68
 
69
69
  def def?(node)
70
- node.def_type? || node.defs_type? ||
70
+ node.type?(:def, :defs) ||
71
71
  (node.block_type? && DEF_METHODS.include?(node.method_name))
72
72
  end
73
73
 
@@ -51,7 +51,7 @@ module Rubocop
51
51
  # So recurse through that to get the name as written in the source.
52
52
  #
53
53
  def class_name_from_node(node, suffix = nil)
54
- return unless node&.type == :const
54
+ return unless node&.const_type?
55
55
 
56
56
  name = node.children[1].to_s
57
57
  name = "#{name}::#{suffix}" if suffix
@@ -29,7 +29,7 @@ module RuboCop
29
29
 
30
30
  # @!method send?(node)
31
31
  def_node_matcher :send?, <<-PATTERN
32
- ({csend | send} _ ${:send :public_send :__send__} ...)
32
+ (call _ ${:send :public_send :__send__} ...)
33
33
  PATTERN
34
34
 
35
35
  def on_send(node)
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop-rspec'
4
+ require_relative 'base'
5
+
6
+ module Rubocop
7
+ module Cop
8
+ module RSpec
9
+ # Flags the use of `assigns` and `render_template`
10
+ # in controller and request specs.
11
+ #
12
+ # @example
13
+ # # bad
14
+ # ssh_key = create(:personal_key, user: user)
15
+ # get admin_credentials_path(filter: 'ssh_keys')
16
+ # expect(assigns(:credentials)).to match_array([ssh_key])
17
+ #
18
+ # # good
19
+ # ssh_keys = create_list(:personal_key, user: user)
20
+ # get admin_credentials_path(filter: 'ssh_keys')
21
+ # expect(response.body).to include(ssh_key.title)
22
+ #
23
+ # # bad
24
+ # expect(response).to render_template :show
25
+ #
26
+ # # good
27
+ # expect(response.body).to include('Cool stuff')
28
+ #
29
+ # @see https://docs.gitlab.com/ee/development/testing_guide/testing_levels.html#about-controller-tests
30
+ # @see https://www.bigbinary.com/blog/changes-to-test-controllers-in-rails-5#reasons-for-removing-assigns-and-assert-template
31
+ class RailsControllerTesting < Base
32
+ MSG_TEMPLATE = "Avoid using `%{name}`. Instead, assert on observable outputs such as the response body. See https://docs.gitlab.com/ee/development/testing_guide/testing_levels.html#about-controller-tests"
33
+
34
+ RESTRICT_ON_SEND = %i[assigns render_template].freeze
35
+
36
+ def on_send(node)
37
+ add_offense(node, message: format(MSG_TEMPLATE, name: node.method_name))
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -41,7 +41,7 @@ module Rubocop
41
41
  def custom_class_or_module_definition?(node)
42
42
  parent = node.parent
43
43
 
44
- (parent.class_type? || parent.module_type?) && node.left_siblings.empty?
44
+ parent.type?(:class, :module) && node.left_siblings.empty?
45
45
  end
46
46
  end
47
47
  end
data/rubocop-rspec.yml CHANGED
@@ -174,6 +174,12 @@ RSpec/PredicateMatcher:
174
174
  RSpec/RepeatedDescription:
175
175
  Enabled: false
176
176
 
177
+ RSpec/RailsControllerTesting:
178
+ Enabled: false
179
+ Include:
180
+ - 'spec/controllers/**/*'
181
+ - 'spec/requests/**/*'
182
+
177
183
  # Ensure RSpec hook blocks are always multi-line.
178
184
  RSpec/SingleLineHook:
179
185
  Enabled: true
data/rubocop-style.yml CHANGED
@@ -127,6 +127,11 @@ Style/DoubleNegation:
127
127
  Style/EndBlock:
128
128
  Enabled: true
129
129
 
130
+ # See https://gitlab.com/gitlab-org/gitlab/-/issues/465428
131
+ Style/EndlessMethod:
132
+ Enabled: true
133
+ EnforcedStyle: disallow
134
+
130
135
  # Favor the use of Fixnum#even? && Fixnum#odd?
131
136
  Style/EvenOdd:
132
137
  Enabled: true
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-styles
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.2
4
+ version: 13.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-27 00:00:00.000000000 Z
11
+ date: 2025-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.68.0
19
+ version: 1.71.1
20
20
  type: :runtime
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.68.0
26
+ version: 1.71.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-capybara
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -358,6 +358,7 @@ files:
358
358
  - lib/rubocop/cop/rspec/empty_line_after_shared_example.rb
359
359
  - lib/rubocop/cop/rspec/example_starting_character.rb
360
360
  - lib/rubocop/cop/rspec/have_link_parameters.rb
361
+ - lib/rubocop/cop/rspec/rails_controller_testing.rb
361
362
  - lib/rubocop/cop/rspec/single_line_hook.rb
362
363
  - lib/rubocop/cop/rspec/specify_expected.rb
363
364
  - lib/rubocop/cop/rspec/useless_dynamic_definition.rb