+312
-19
lines changedFilter options
+312
-19
lines changed Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ output by `rubocop -V`, include them as well. Here's an example:
39
39
40
40
```
41
41
$ [bundle exec] rubocop -V
42
-
1.76.2 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
42
+
1.77.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
43
43
- rubocop-performance 1.22.1
44
44
- rubocop-rspec 3.1.0
45
45
```
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@
11
11
12
12
## master (unreleased)
13
13
14
+
## 1.77.0 (2025-06-20)
15
+
14
16
### New features
15
17
16
18
* [#14223](https://github.com/rubocop/rubocop/pull/14223): Add new `Gemspec/AttributeAssignment` cop. ([@viralpraxis][])
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ do so.
17
17
18
18
```console
19
19
$ rubocop -V
20
-
1.76.2 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
20
+
1.77.0 (using Parser 3.3.5.0, rubocop-ast 1.32.3, analyzing as Ruby 3.3, running on ruby 3.3.5) [x86_64-linux]
21
21
- rubocop-performance 1.22.1
22
22
- rubocop-rspec 3.1.0
23
23
```
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
53
53
in your `Gemfile`:
54
54
55
55
```rb
56
-
gem 'rubocop', '~> 1.76', require: false
56
+
gem 'rubocop', '~> 1.77', require: false
57
57
```
58
58
59
59
See [our versioning policy](https://docs.rubocop.org/rubocop/versioning.html) for further details.
Original file line number Diff line number Diff line change
@@ -284,7 +284,7 @@ Gemspec/AddRuntimeDependency:
284
284
Gemspec/AttributeAssignment:
285
285
Description: 'Use consistent style for Gemspec attributes assignment.'
286
286
Enabled: pending
287
-
VersionAdded: '<<next>>'
287
+
VersionAdded: '1.77'
288
288
Include:
289
289
- '**/*.gemspec'
290
290
@@ -3673,7 +3673,7 @@ Style/CollectionQuerying:
3673
3673
Description: 'Prefer `Enumerable` predicate methods over expressions with `count`.'
3674
3674
StyleGuide: '#collection-querying'
3675
3675
Enabled: pending
3676
-
VersionAdded: '<<next>>'
3676
+
VersionAdded: '1.77'
3677
3677
Safe: false
3678
3678
3679
3679
Style/ColonMethodCall:
Original file line number Diff line number Diff line change
@@ -2,6 +2,6 @@ name: rubocop
2
2
title: RuboCop
3
3
# We always provide version without patch here (e.g. 1.1),
4
4
# as patch versions should not appear in the docs.
5
-
version: ~
5
+
version: '1.77'
6
6
nav:
7
7
- modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -87,6 +87,7 @@ In the following section you find all available cops:
87
87
=== Department xref:cops_gemspec.adoc[Gemspec]
88
88
89
89
* xref:cops_gemspec.adoc#gemspecaddruntimedependency[Gemspec/AddRuntimeDependency]
90
+
* xref:cops_gemspec.adoc#gemspecattributeassignment[Gemspec/AttributeAssignment]
90
91
* xref:cops_gemspec.adoc#gemspecdependencyversion[Gemspec/DependencyVersion]
91
92
* xref:cops_gemspec.adoc#gemspecdeprecatedattributeassignment[Gemspec/DeprecatedAttributeAssignment]
92
93
* xref:cops_gemspec.adoc#gemspecdevelopmentdependencies[Gemspec/DevelopmentDependencies]
@@ -434,6 +435,7 @@ In the following section you find all available cops:
434
435
* xref:cops_style.adoc#styleclassvars[Style/ClassVars]
435
436
* xref:cops_style.adoc#stylecollectioncompact[Style/CollectionCompact]
436
437
* xref:cops_style.adoc#stylecollectionmethods[Style/CollectionMethods]
438
+
* xref:cops_style.adoc#stylecollectionquerying[Style/CollectionQuerying]
437
439
* xref:cops_style.adoc#stylecolonmethodcall[Style/ColonMethodCall]
438
440
* xref:cops_style.adoc#stylecolonmethoddefinition[Style/ColonMethodDefinition]
439
441
* xref:cops_style.adoc#stylecombinabledefined[Style/CombinableDefined]
Original file line number Diff line number Diff line change
@@ -55,6 +55,85 @@ end
55
55
* https://rubystyle.guide#add_dependency_vs_add_runtime_dependency
56
56
* https://github.com/rubygems/rubygems/issues/7799#issuecomment-2192720316
57
57
58
+
[#gemspecattributeassignment]
59
+
== Gemspec/AttributeAssignment
60
+
61
+
|===
62
+
| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed
63
+
64
+
| Pending
65
+
| Yes
66
+
| No
67
+
| 1.77
68
+
| -
69
+
|===
70
+
71
+
Use consistent style for Gemspec attributes assignment.
72
+
73
+
[#examples-gemspecattributeassignment]
74
+
=== Examples
75
+
76
+
[source,ruby]
77
+
----
78
+
# bad
79
+
# This example uses two styles for assignment of metadata attribute.
80
+
Gem::Specification.new do |spec|
81
+
spec.metadata = { 'key' => 'value' }
82
+
spec.metadata['another-key'] = 'another-value'
83
+
end
84
+
85
+
# good
86
+
Gem::Specification.new do |spec|
87
+
spec.metadata['key'] = 'value'
88
+
spec.metadata['another-key'] = 'another-value'
89
+
end
90
+
91
+
# good
92
+
Gem::Specification.new do |spec|
93
+
spec.metadata = { 'key' => 'value', 'another-key' => 'another-value' }
94
+
end
95
+
96
+
# bad
97
+
# This example uses two styles for assignment of authors attribute.
98
+
Gem::Specification.new do |spec|
99
+
spec.authors = %w[author-0 author-1]
100
+
spec.authors[2] = 'author-2'
101
+
end
102
+
103
+
# good
104
+
Gem::Specification.new do |spec|
105
+
spec.authors = %w[author-0 author-1 author-2]
106
+
end
107
+
108
+
# good
109
+
Gem::Specification.new do |spec|
110
+
spec.authors[0] = 'author-0'
111
+
spec.authors[1] = 'author-1'
112
+
spec.authors[2] = 'author-2'
113
+
end
114
+
115
+
# good
116
+
# This example uses consistent assignment per attribute,
117
+
# even though two different styles are used overall.
118
+
Gem::Specification.new do |spec|
119
+
spec.metadata = { 'key' => 'value' }
120
+
spec.authors[0] = 'author-0'
121
+
spec.authors[1] = 'author-1'
122
+
spec.authors[2] = 'author-2'
123
+
end
124
+
----
125
+
126
+
[#configurable-attributes-gemspecattributeassignment]
127
+
=== Configurable attributes
128
+
129
+
|===
130
+
| Name | Default value | Configurable values
131
+
132
+
| Include
133
+
| `+**/*.gemspec+`
134
+
| Array
135
+
|===
136
+
58
137
[#gemspecdependencyversion]
59
138
== Gemspec/DependencyVersion
60
139
Original file line number Diff line number Diff line change
@@ -4923,6 +4923,10 @@ bar: "0000000000", baz: "0000000000"}
4923
4923
| `true`
4924
4924
| Boolean
4925
4925
4926
+
| AllowQualifiedName
4927
+
| `true`
4928
+
| Boolean
4929
+
4926
4930
| URISchemes
4927
4931
| `http`, `https`
4928
4932
| Array
@@ -4935,10 +4939,6 @@ bar: "0000000000", baz: "0000000000"}
4935
4939
| `[]`
4936
4940
| Array
4937
4941
4938
-
| AllowQualifiedName
4939
-
| `true`
4940
-
| Boolean
4941
-
4942
4942
| SplitStrings
4943
4943
| `false`
4944
4944
| Boolean
Original file line number Diff line number Diff line change
@@ -6267,6 +6267,30 @@ obj.attr = obj.attr2
6267
6267
hash[foo] = hash[foo]
6268
6268
----
6269
6269
6270
+
[#allowrbsinlineannotation_true-lintselfassignment]
6271
+
==== AllowRBSInlineAnnotation:true
6272
+
6273
+
[source,ruby]
6274
+
----
6275
+
# good
6276
+
foo = foo #: Integer
6277
+
foo, bar = foo, bar #: Integer
6278
+
Foo = Foo #: Integer
6279
+
hash['foo'] = hash['foo'] #: Integer
6280
+
obj.attr = obj.attr #: Integer
6281
+
----
6282
+
6283
+
[#configurable-attributes-lintselfassignment]
6284
+
=== Configurable attributes
6285
+
6286
+
|===
6287
+
| Name | Default value | Configurable values
6288
+
6289
+
| AllowRBSInlineAnnotation
6290
+
| `false`
6291
+
| Boolean
6292
+
|===
6293
+
6270
6294
[#lintsendwithmixinargument]
6271
6295
== Lint/SendWithMixinArgument
6272
6296
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4