rubocop-dbl 1.2.0 → 2.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: 1b5856effa41bb2d7e4dde8aefb6f9944b84801e9683a8fd8383e446ae293a5a
4
- data.tar.gz: cf576d04a8975fb239afcaf06d63a9138de9bf32916acb8bb9eb32be7d704e49
3
+ metadata.gz: 3ec53394cf1a5816713e5bf4c77e1e88649fb7a049081c253da7cb971e91463e
4
+ data.tar.gz: 9b748ef9863698f9b6db0318dc22a94cec63314b77f6a0f161e9e0da20a314ab
5
5
  SHA512:
6
- metadata.gz: 44ae420c179b0be16109a50b0b45b5ea7c9561c10e5a7e3650628cc815613a65410329f621e47f57f94cb5dc8dd0cd03d3390a8a5ab97bd9a7ac40918f2afc73
7
- data.tar.gz: 44d1c398449529e67d03c0fe1c9752a58207e84e91de19e8b5f561eb65d1da8876584a7551e2278aae8136a8d591c8810ae119f72c48469d685da5c1c4fdf16b
6
+ metadata.gz: c49572ee20abe581d8412897f5a1fea1c1b90bde6d4aded720e97e2fe8612cd23631486575fdba9d73341b5e8669741f54d9862b0a5018d0b18ee36bde47b9ca
7
+ data.tar.gz: b8e0899af2188c0634f8af1ce420a53a1b2ce07c83f32b2e03bed6e36b079c6d8af1ee82c60983fd8039f119469833bd58b9bb4a0dab9324646db36eb900e3ad
data/README.md CHANGED
@@ -26,6 +26,20 @@ rails generate rubocop_dbl:install
26
26
 
27
27
  or manually Aad this line to your application's `.rubocop.yml`:
28
28
 
29
+ When using Rails:
30
+
31
+ ```yml
32
+ require:
33
+ - rubocop-rails
34
+
35
+ inherit_gem:
36
+ rubocop-dbl:
37
+ - config/dbl.yml
38
+ - config/cops/rails.yml
39
+ ```
40
+
41
+ When not using Rails:
42
+
29
43
  ```yml
30
44
  inherit_gem:
31
45
  rubocop-dbl:
@@ -24,3 +24,10 @@ Layout/ParameterAlignment:
24
24
  SupportedStyles:
25
25
  - with_first_parameter
26
26
  - with_fixed_indentation
27
+
28
+ Layout/LineLength:
29
+ Max: 120
30
+ IgnoreCopDirectives: true
31
+ AllowedPatterns: ['\s#\s'] # allows comments to overflow the line length. E.g. for URLs
32
+ Exclude:
33
+ - 'spec/**/*'
@@ -76,3 +76,7 @@ Style/RedundantArgument:
76
76
 
77
77
  Style/SwapValues:
78
78
  Enabled: true
79
+
80
+ # "private_class_method" must always be inlined, no need for a cop
81
+ Style/AccessModifierDeclarations:
82
+ EnforcedStyle: inline
@@ -11,8 +11,14 @@
11
11
  #
12
12
 
13
13
  Sorbet/HasSigil:
14
- MinimumStrictness: true
14
+ MinimumStrictness: strict
15
15
  SuggestedStrictness: strict
16
16
  Exclude:
17
- - spec/**/*
18
- - test/**/*
17
+ - "spec/**/*"
18
+ - "test/**/*"
19
+
20
+ Sorbet/StrictSigil:
21
+ Enabled: true
22
+ Exclude:
23
+ - "spec/**/*"
24
+ - "lib/tasks/**/*"
data/config/dbl.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  require:
2
2
  - rubocop-packaging
3
3
  - rubocop-performance
4
- - rubocop-rails
5
4
  - rubocop-rspec
6
5
  - rubocop-sorbet
7
6
 
@@ -12,7 +11,6 @@ inherit_from:
12
11
  - cops/metrics.yml
13
12
  - cops/naming.yml
14
13
  - cops/performance.yml
15
- - cops/rails.yml
16
14
  - cops/rspec.yml
17
15
  - cops/style.yml
18
16
  - cops/types.yml
@@ -22,7 +20,7 @@ inherit_from:
22
20
  # see: https://docs.rubocop.org/rubocop/usage/caching.html
23
21
  AllCops:
24
22
  UseCache: true
25
- TargetRubyVersion: 2.7.2
23
+ TargetRubyVersion: 3.0.0
26
24
  NewCops: enable
27
25
  Exclude:
28
26
  - '**/tmp/**/*'
@@ -32,7 +30,6 @@ AllCops:
32
30
  - 'actionmailbox/test/dummy/**/*'
33
31
  - 'actiontext/test/dummy/**/*'
34
32
  - '**/node_modules/**/*'
35
- # Additional exclude files by rubocop-rails
36
33
  - 'bin/**/*'
37
34
  - 'config/**/*'
38
35
  - 'db/**/*'
@@ -1,34 +1,151 @@
1
1
  # typed: false
2
2
 
3
3
  require 'rails/generators/base'
4
- require 'active_support/core_ext/string'
5
4
  require 'railties'
6
5
 
7
6
  module RubocopDbl
8
7
  module Generators
9
8
  class InstallGenerator < Rails::Generators::Base
10
- desc 'Creates a .rubocop.yml config file that inherits from the official Ruby on Rails .rubocop.yml.'
9
+ desc 'Creates a .rubocop.yml config file that inherits from the various rubocop gems (Rails optional).'
11
10
 
12
11
  def create_config_file
13
12
  file_method = config_file_exists? ? :prepend : :create
14
- send :"#{file_method}_file", config_file_path, config_file_content
15
- end
13
+ content = defined?(Rails) ? config_file_content_rails : config_file_content
16
14
 
17
- private
15
+ send(
16
+ :"#{file_method}_file",
17
+ config_file_path,
18
+ content,
19
+ )
20
+ end
18
21
 
19
- def config_file_exists?
22
+ private def config_file_exists?
20
23
  File.exist?(config_file_path)
21
24
  end
22
25
 
23
- def config_file_path
26
+ private def config_file_path
24
27
  '.rubocop.yml'
25
28
  end
26
29
 
27
- def config_file_content
30
+ private def config_file_content
31
+ <<~HEREDOC
32
+ inherit_gem:
33
+ rubocop-dbl:
34
+ - config/dbl.yml
35
+
36
+ # we do not want to overwrite the base-array (from rubocop-dbl), but extend it
37
+ inherit_mode:
38
+ merge:
39
+ - Exclude
40
+
41
+ AllCops:
42
+ TargetRubyVersion: 3.3.0
43
+ Exclude:
44
+ - 'sorbet/rbi/shims/**/*'
45
+ HEREDOC
46
+ end
47
+
48
+ private def config_file_content_rails
28
49
  <<~HEREDOC
50
+ require:
51
+ - rubocop-rails
52
+
29
53
  inherit_gem:
30
54
  rubocop-dbl:
31
55
  - config/dbl.yml
56
+
57
+ inherit_mode:
58
+ merge:
59
+ - Exclude
60
+
61
+ AllCops:
62
+ TargetRubyVersion: 3.3.0
63
+ Exclude:
64
+ - 'sorbet/rbi/shims/**/*'
65
+
66
+ # Defaults for this cop are found here:
67
+ # https://github.com/rubocop/rubocop-rails/blob/master/config/default.yml
68
+ #
69
+ # Add customizations below.
70
+ #
71
+ # Ensure to document why we change a default by linking the corresponding PR.
72
+ # For example:
73
+ #
74
+ # Rails/ActionFilter:
75
+ # Enabled: false
76
+ #
77
+
78
+ # @NOTE: added: "staging"
79
+ Rails/UnknownEnv:
80
+ Environments:
81
+ - production
82
+ - development
83
+ - test
84
+ - staging
85
+
86
+ # @NOTE: disabled
87
+ Rails/HttpStatus:
88
+ Enabled: false
89
+
90
+ # @NOTE: disabled
91
+ Rails/ApplicationController:
92
+ Enabled: false
93
+
94
+
95
+ #
96
+ # @NOTE: all the cops ahead are "pending" in the current default config
97
+ #
98
+ Rails/ActiveRecordCallbacksOrder:
99
+ Enabled: true
100
+
101
+ Rails/AfterCommitOverride:
102
+ Enabled: true
103
+
104
+ Rails/AttributeDefaultBlockValue:
105
+ Enabled: true
106
+
107
+ Rails/FindById:
108
+ Enabled: true
109
+
110
+ Rails/Inquiry:
111
+ Enabled: true
112
+
113
+ Rails/MailerName:
114
+ Enabled: true
115
+
116
+ Rails/MatchRoute:
117
+ Enabled: true
118
+
119
+ Rails/NegateInclude:
120
+ Enabled: true
121
+
122
+ Rails/Pluck:
123
+ Enabled: true
124
+
125
+ Rails/PluckInWhere:
126
+ Enabled: true
127
+
128
+ Rails/RenderInline:
129
+ Enabled: true
130
+
131
+ Rails/RenderPlainText:
132
+ Enabled: true
133
+
134
+ Rails/ShortI18n:
135
+ Enabled: true
136
+ EnforcedStyle: aggressive
137
+
138
+ Rails/SquishedSQLHeredocs:
139
+ Enabled: true
140
+
141
+ Rails/WhereEquals:
142
+ Enabled: true
143
+
144
+ Rails/WhereExists:
145
+ Enabled: true
146
+
147
+ Rails/WhereNot:
148
+ Enabled: true
32
149
  HEREDOC
33
150
  end
34
151
  end
@@ -1,5 +1,5 @@
1
1
  # typed: false
2
2
 
3
3
  module RubocopDbl
4
- VERSION = '1.2.0'.freeze
4
+ VERSION = '2.1.0'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-dbl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'Team DBL :rocket:'
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-26 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rubocop-rspec
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +107,6 @@ files:
121
107
  - config/cops/metrics.yml
122
108
  - config/cops/naming.yml
123
109
  - config/cops/performance.yml
124
- - config/cops/rails.yml
125
110
  - config/cops/rspec.yml
126
111
  - config/cops/style.yml
127
112
  - config/cops/types.yml
@@ -141,14 +126,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
126
  requirements:
142
127
  - - ">="
143
128
  - !ruby/object:Gem::Version
144
- version: '2.7'
129
+ version: '3.0'
145
130
  required_rubygems_version: !ruby/object:Gem::Requirement
146
131
  requirements:
147
132
  - - ">="
148
133
  - !ruby/object:Gem::Version
149
134
  version: '0'
150
135
  requirements: []
151
- rubygems_version: 3.4.13
136
+ rubygems_version: 3.5.6
152
137
  signing_key:
153
138
  specification_version: 4
154
139
  summary: RuboCop configuration for our Ruby on Rails projects
@@ -1,83 +0,0 @@
1
- # Defaults for this cop are found here:
2
- # https://github.com/rubocop/rubocop-rails/blob/master/config/default.yml
3
- #
4
- # Add customizations below.
5
- #
6
- # Ensure to document why we change a default by linking the corresponding PR.
7
- # For example:
8
- #
9
- # Rails/ActionFilter:
10
- # Enabled: false
11
- #
12
-
13
- # @NOTE: added: "staging"
14
- Rails/UnknownEnv:
15
- Environments:
16
- - production
17
- - development
18
- - test
19
- - staging
20
-
21
- # @NOTE: disabled
22
- Rails/HttpStatus:
23
- Enabled: false
24
-
25
- # @NOTE: disabled
26
- Rails/ApplicationController:
27
- Enabled: false
28
-
29
-
30
- #
31
- # @NOTE: all the cops ahead are "pending" in the current default config
32
- #
33
- Rails/ActiveRecordCallbacksOrder:
34
- Enabled: true
35
-
36
- Rails/AfterCommitOverride:
37
- Enabled: true
38
-
39
- Rails/AttributeDefaultBlockValue:
40
- Enabled: true
41
-
42
- Rails/FindById:
43
- Enabled: true
44
-
45
- Rails/Inquiry:
46
- Enabled: true
47
-
48
- Rails/MailerName:
49
- Enabled: true
50
-
51
- Rails/MatchRoute:
52
- Enabled: true
53
-
54
- Rails/NegateInclude:
55
- Enabled: true
56
-
57
- Rails/Pluck:
58
- Enabled: true
59
-
60
- Rails/PluckInWhere:
61
- Enabled: true
62
-
63
- Rails/RenderInline:
64
- Enabled: true
65
-
66
- Rails/RenderPlainText:
67
- Enabled: true
68
-
69
- Rails/ShortI18n:
70
- Enabled: true
71
- EnforcedStyle: aggressive
72
-
73
- Rails/SquishedSQLHeredocs:
74
- Enabled: true
75
-
76
- Rails/WhereEquals:
77
- Enabled: true
78
-
79
- Rails/WhereExists:
80
- Enabled: true
81
-
82
- Rails/WhereNot:
83
- Enabled: true