gitlab-styles 6.2.1 → 6.3.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: c3dfc98241b9f277b993b5a8e599903c804202bf1324e5770463f7f0f85dee91
4
- data.tar.gz: 0d52074c0f1b5679c777e290094b36a2b2ecc473a3239e406134d1c014614cf4
3
+ metadata.gz: bdb4b922d729575676263e2cb9cf6f63b50be1d8b4205d96af7ecb6aaa2c4c84
4
+ data.tar.gz: 46a11af0a19079547b1d25e988e80d8271a5fe15fda707096662aee73a4cc9c3
5
5
  SHA512:
6
- metadata.gz: 2e644dfd8ee68ec0700f5953d65fc0c6b2e535b20779e317178360b5879fa174f3c9d44077cdf0dee2bb28b79054d053ff8673b2c609dc4bd7262bd38566b428
7
- data.tar.gz: dc9fbcf0d42ed4b8ce6e9dd05348068aa3478d987b03fc4306d6e0b55893b619de5b0e0830285f9f2f59bcc38e02be9b61046523a20b3c46b049ce52b93cf1e4
6
+ metadata.gz: df88cc8b9ea74b138c8768130b310d50d2204bed62e4648b292a8b0f058dad46335e23432564a546e0acc0ae9ef3c8a2487f4690f8e4ee2a73e6209665441746
7
+ data.tar.gz: 2d744fd1097268298c1073404bf84ddd4d65b28dbfa4b5bfad95857ea310734d24f93b81870e0c03454c26a2aa8de19470c7f75374e73db25ac0067a2665bebf
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../model_helpers'
4
+
5
+ module Gitlab
6
+ module Styles
7
+ module Rubocop
8
+ module Cop
9
+ module Rails
10
+ class IncludeUrlHelper < RuboCop::Cop::Cop
11
+ MSG = <<~MSG
12
+ Avoid including `ActionView::Helpers::UrlHelper`.
13
+ It adds/overrides ~40 methods while usually only one is needed.
14
+ Instead, use the `Gitlab::Routing.url_helpers`/`Application.routes.url_helpers`(outside of gitlab)
15
+ and `ActionController::Base.helpers.link_to`.
16
+ See https://gitlab.com/gitlab-org/gitlab/-/issues/340567.
17
+ MSG
18
+
19
+ def_node_matcher :include_url_helpers_node?, <<~PATTERN
20
+ (send nil? :include (const (const (const {nil? cbase} :ActionView) :Helpers) :UrlHelper))
21
+ PATTERN
22
+
23
+ def on_send(node)
24
+ add_offense(node) if include_url_helpers_node?(node)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module Styles
5
- VERSION = '6.2.1'
5
+ VERSION = '6.3.0'
6
6
  end
7
7
  end
data/rubocop-rails.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  require:
3
3
  - rubocop-rails
4
+ - ./lib/gitlab/styles/rubocop
4
5
 
5
6
  # Enables Rails cops.
6
7
  Rails:
@@ -186,3 +187,7 @@ Rails/WhereExists:
186
187
  # https://docs.rubocop.org/rubocop-rails/2.8/cops_rails.html#railswherenot
187
188
  Rails/WhereNot:
188
189
  Enabled: true
190
+
191
+ # Bans the use of `include ActionView::Helpers::UrlHelper`.
192
+ Rails/IncludeUrlHelper:
193
+ Enabled: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-styles
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.1
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitLab
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-12 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -164,6 +164,7 @@ files:
164
164
  - lib/gitlab/styles/rubocop/cop/line_break_around_conditional_block.rb
165
165
  - lib/gitlab/styles/rubocop/cop/migration/update_large_table.rb
166
166
  - lib/gitlab/styles/rubocop/cop/polymorphic_associations.rb
167
+ - lib/gitlab/styles/rubocop/cop/rails/include_url_helper.rb
167
168
  - lib/gitlab/styles/rubocop/cop/redirect_with_status.rb
168
169
  - lib/gitlab/styles/rubocop/cop/rspec/base.rb
169
170
  - lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb