Skip to content

Commit 746c1be

Browse files
committedNov 23, 2020
Cut 1.4
1 parent 4a388c0 commit 746c1be

File tree

13 files changed

+194
-14
lines changed

13 files changed

+194
-14
lines changed
 

‎.github/ISSUE_TEMPLATE/bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ Include the output of `rubocop -V` or `bundle exec rubocop -V` if using Bundler.
3636

3737
```
3838
$ [bundle exec] rubocop -V
39-
1.3.1 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
39+
1.4.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
4040
```

‎CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## master (unreleased)
44

5+
## 1.4.0 (2020-11-23)
6+
57
### New features
68

79
* [#7737](https://github.com/rubocop-hq/rubocop/issues/7737): Add new `Style/RedundantArgument` cop. ([@tejasbubane][])

‎CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ do so.
1717

1818
```
1919
$ rubocop -V
20-
1.3.1 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
20+
1.4.0 (using Parser 2.7.2.0, rubocop-ast 1.1.1, running on ruby 2.7.2 x86_64-linux)
2121
```
2222

2323
* Include any relevant code to the issue summary.

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ To prevent an unwanted RuboCop update you might want to use a conservative versi
5151
in your `Gemfile`:
5252

5353
```rb
54-
gem 'rubocop', '~> 1.3', require: false
54+
gem 'rubocop', '~> 1.4', require: false
5555
```
5656

5757
See [versioning](https://docs.rubocop.org/rubocop/1.0/versioning.html) for further details.

‎config/default.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ Layout/EmptyLineBetweenDefs:
463463
StyleGuide: '#empty-lines-between-methods'
464464
Enabled: true
465465
VersionAdded: '0.49'
466-
VersionChanged: <<next>>
466+
VersionChanged: '1.4'
467467
EmptyLineBetweenMethodDefs: true
468468
EmptyLineBetweenClassDefs: true
469469
EmptyLineBetweenModuleDefs: true
@@ -895,7 +895,7 @@ Layout/LineLength:
895895
StyleGuide: '#max-line-length'
896896
Enabled: true
897897
VersionAdded: '0.25'
898-
VersionChanged: '<<next>>'
898+
VersionChanged: '1.4'
899899
AutoCorrect: true
900900
Max: 120
901901
# To make it possible to copy or click on URIs in the code, we allow lines
@@ -1688,7 +1688,7 @@ Lint/MissingSuper:
16881688
without calls to `super`'.
16891689
Enabled: true
16901690
VersionAdded: '0.89'
1691-
VersionChanged: '<<next>>'
1691+
VersionChanged: '1.4'
16921692

16931693
Lint/MixedRegexpCaptureTypes:
16941694
Description: 'Do not mix named captures and numbered captures in a Regexp literal.'
@@ -3985,7 +3985,7 @@ Style/RedundantArgument:
39853985
Description: 'Check for a redundant argument passed to certain methods.'
39863986
Enabled: pending
39873987
Safe: false
3988-
VersionAdded: <<next>>
3988+
VersionAdded: '1.4'
39893989
Methods:
39903990
# Array#join
39913991
join: ''

‎docs/antora.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: rubocop
22
title: RuboCop
33
# We always provide version without patch here (e.g. 1.1),
44
# as patch versions should not appear in the docs.
5-
version: 'master'
5+
version: '1.4'
66
nav:
77
- modules/ROOT/nav.adoc

‎docs/modules/ROOT/pages/cops.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ In the following section you find all available cops:
474474
* xref:cops_style.adoc#styleproc[Style/Proc]
475475
* xref:cops_style.adoc#styleraiseargs[Style/RaiseArgs]
476476
* xref:cops_style.adoc#stylerandomwithoffset[Style/RandomWithOffset]
477+
* xref:cops_style.adoc#styleredundantargument[Style/RedundantArgument]
477478
* xref:cops_style.adoc#styleredundantassignment[Style/RedundantAssignment]
478479
* xref:cops_style.adoc#styleredundantbegin[Style/RedundantBegin]
479480
* xref:cops_style.adoc#styleredundantcapitalw[Style/RedundantCapitalW]

‎docs/modules/ROOT/pages/cops_layout.adoc

+75-3
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ end
13921392
| Yes
13931393
| Yes
13941394
| 0.49
1395-
| -
1395+
| 1.4
13961396
|===
13971397

13981398
This cop checks whether method definitions are
@@ -1407,8 +1407,12 @@ one-line method definitions are considered an offense.
14071407

14081408
=== Examples
14091409

1410+
==== EmptyLineBetweenMethodDefs: true (default)
1411+
14101412
[source,ruby]
14111413
----
1414+
# checks for empty lines between method definitions.
1415+
14121416
# bad
14131417
def a
14141418
end
@@ -1426,11 +1430,79 @@ def b
14261430
end
14271431
----
14281432

1433+
==== EmptyLineBetweenClassDefs: true (default)
1434+
1435+
[source,ruby]
1436+
----
1437+
# checks for empty lines between class definitions.
1438+
1439+
# bad
1440+
class A
1441+
end
1442+
class B
1443+
end
1444+
def b
1445+
end
1446+
----
1447+
1448+
[source,ruby]
1449+
----
1450+
# good
1451+
class A
1452+
end
1453+
1454+
class B
1455+
end
1456+
1457+
def b
1458+
end
1459+
----
1460+
1461+
==== EmptyLineBetweenModuleDefs: true (default)
1462+
1463+
[source,ruby]
1464+
----
1465+
# checks for empty lines between module definitions.
1466+
1467+
# bad
1468+
module A
1469+
end
1470+
module B
1471+
end
1472+
def b
1473+
end
1474+
----
1475+
1476+
[source,ruby]
1477+
----
1478+
# good
1479+
module A
1480+
end
1481+
1482+
module B
1483+
end
1484+
1485+
def b
1486+
end
1487+
----
1488+
14291489
=== Configurable attributes
14301490

14311491
|===
14321492
| Name | Default value | Configurable values
14331493

1494+
| EmptyLineBetweenMethodDefs
1495+
| `true`
1496+
| Boolean
1497+
1498+
| EmptyLineBetweenClassDefs
1499+
| `true`
1500+
| Boolean
1501+
1502+
| EmptyLineBetweenModuleDefs
1503+
| `true`
1504+
| Boolean
1505+
14341506
| AllowAdjacentOneLineDefs
14351507
| `false`
14361508
| Boolean
@@ -3792,7 +3864,7 @@ end
37923864
| Yes
37933865
| Yes
37943866
| 0.25
3795-
| 1.3
3867+
| 1.4
37963868
|===
37973869

37983870
This cop checks the length of lines in the source code.
@@ -3858,7 +3930,7 @@ bar: "0000000000", baz: "0000000000"}
38583930
| Name | Default value | Configurable values
38593931

38603932
| AutoCorrect
3861-
| `false`
3933+
| `true`
38623934
| Boolean
38633935

38643936
| Max

‎docs/modules/ROOT/pages/cops_lint.adoc

+9-1
Original file line numberDiff line numberDiff line change
@@ -2489,12 +2489,17 @@ x += 1
24892489
| Yes
24902490
| No
24912491
| 0.89
2492-
| -
2492+
| 1.4
24932493
|===
24942494

24952495
This cop checks for the presence of constructors and lifecycle callbacks
24962496
without calls to `super`.
24972497

2498+
This cop does not consider `method_missing` (and `respond_to_missing?`)
2499+
because in some cases it makes sense to overtake what is considered a
2500+
missing method. In other cases, the theoretical ideal handling could be
2501+
challenging or verbose for no actual gain.
2502+
24982503
=== Examples
24992504

25002505
[source,ruby]
@@ -4696,6 +4701,9 @@ values.reduce(nil) do |result, value|
46964701
value
46974702
end
46984703
4704+
# good, recursive
4705+
keys.reduce(self) { |result, key| result[key] }
4706+
46994707
# ignored as the return value cannot be determined
47004708
enum.reduce do |acc, el|
47014709
x = foo(acc, el)

‎docs/modules/ROOT/pages/cops_style.adoc

+63
Original file line numberDiff line numberDiff line change
@@ -2393,6 +2393,11 @@ end
23932393
module Namespace
23942394
Public = Class.new
23952395
end
2396+
2397+
# Macro calls
2398+
module Namespace
2399+
extend Foo
2400+
end
23962401
----
23972402

23982403
=== Configurable attributes
@@ -7883,6 +7888,64 @@ rand(1...7)
78837888

78847889
* https://rubystyle.guide#random-numbers
78857890

7891+
== Style/RedundantArgument
7892+
7893+
|===
7894+
| Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged
7895+
7896+
| Pending
7897+
| No
7898+
| No
7899+
| 1.4
7900+
| -
7901+
|===
7902+
7903+
This cop checks for a redundant argument passed to certain methods.
7904+
7905+
Limitations:
7906+
7907+
1. This cop matches for method names only and hence cannot tell apart
7908+
methods with same name in different classes.
7909+
2. This cop is limited to methods with single parameter.
7910+
3. This cop is unsafe if certain special global variables (e.g. `$;`) are set.
7911+
That depends on the nature of the target methods, of course.
7912+
7913+
Method names and their redundant arguments can be configured like this:
7914+
7915+
Methods:
7916+
join: ''
7917+
split: ' '
7918+
foo: 2
7919+
7920+
=== Examples
7921+
7922+
[source,ruby]
7923+
----
7924+
# bad
7925+
array.join('')
7926+
[1, 2, 3].join("")
7927+
string.split(" ")
7928+
"first\nsecond".split(" ")
7929+
A.foo(2)
7930+
7931+
# good
7932+
array.join
7933+
[1, 2, 3].join
7934+
string.split
7935+
"first second".split
7936+
A.foo
7937+
----
7938+
7939+
=== Configurable attributes
7940+
7941+
|===
7942+
| Name | Default value | Configurable values
7943+
7944+
| Methods
7945+
| `{"join"=>"", "split"=>" "}`
7946+
|
7947+
|===
7948+
78867949
== Style/RedundantAssignment
78877950

78887951
|===

‎docs/modules/ROOT/pages/installation.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ in your `Gemfile`:
2222

2323
[source,rb]
2424
----
25-
gem 'rubocop', '~> 1.3', require: false
25+
gem 'rubocop', '~> 1.4', require: false
2626
----
2727

2828
NOTE: You can check out our progress on the road to version 1.0 https://github.com/rubocop-hq/rubocop/milestone/4[here].

‎lib/rubocop/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module RuboCop
44
# This module holds the RuboCop version information.
55
module Version
6-
STRING = '1.3.1'
6+
STRING = '1.4.0'
77

88
MSG = '%<version>s (using Parser %<parser_version>s, '\
99
'rubocop-ast %<rubocop_ast_version>s, ' \

‎relnotes/v1.4.0.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### New features
2+
3+
* [#7737](https://github.com/rubocop-hq/rubocop/issues/7737): Add new `Style/RedundantArgument` cop. ([@tejasbubane][])
4+
* [#9064](https://github.com/rubocop-hq/rubocop/issues/9064): Add `EmptyLineBetweenMethodDefs`, `EmptyLineBetweenClassDefs` and `EmptyLineBetweenModuleDefs` config options for `Layout/EmptyLineBetweenDefs` cop. ([@tejasbubane][])
5+
* [#9043](https://github.com/rubocop-hq/rubocop/pull/9043): Add `--stderr` to write all output to stderr except for the autocorrected source. ([@knu][])
6+
7+
### Bug fixes
8+
9+
* [#9067](https://github.com/rubocop-hq/rubocop/pull/9067): Fix an incorrect auto-correct for `Lint::AmbiguousRegexpLiteral` when passing in a regexp to a method with no receiver. ([@amatsuda][])
10+
* [#9060](https://github.com/rubocop-hq/rubocop/issues/9060): Fix an error for `Layout/SpaceAroundMethodCallOperator` when using `__ENCODING__`. ([@koic][])
11+
* [#7338](https://github.com/rubocop-hq/rubocop/issues/7338): Handle assignment with `[]=` in `MultilineMethodCallIndentation`. ([@jonas054][])
12+
13+
* [#7726](https://github.com/rubocop-hq/rubocop/issues/7726): Fix `MultilineMethodCallIndentation` indentation inside square brackets. ([@jonas054][])
14+
* [#8857](https://github.com/rubocop-hq/rubocop/issues/8857): Improve how `Exclude` properties are generated by `--auto-gen-config`. ([@jonas054][])
15+
16+
### Changes
17+
18+
* [#8788](https://github.com/rubocop-hq/rubocop/issues/8788): Change `Style/Documentation` to not trigger offense with only macros. ([@tejasbubane][])
19+
* [#8993](https://github.com/rubocop-hq/rubocop/issues/8993): Allow `ExcludedMethods` config of `Metrics/MethodLength` cop to contain regex. ([@tejasbubane][])
20+
* [#9073](https://github.com/rubocop-hq/rubocop/issues/9073): Enable `Layout/LineLength`'s auto-correct by default. ([@bbatsov][])
21+
* [#9079](https://github.com/rubocop-hq/rubocop/pull/9079): Improve the gemspec to load only the necessary files without the git utility. ([@piotrmurach][])
22+
* [#9059](https://github.com/rubocop-hq/rubocop/pull/9059): Update `Lint/UnmodifiedReduceAccumulator` to accept blocks which return in the form `accumulator[element]`. ([@dvandersluis][])
23+
* [#9072](https://github.com/rubocop-hq/rubocop/pull/9072): `Lint/MissingSuper`: exclude `method_missing` and `respond_to_missing?`. ([@marcandre][])
24+
* [#9074](https://github.com/rubocop-hq/rubocop/pull/9074): Allow specifying a pull request ID when calling `rake changelog:*`. ([@marcandre][])
25+
26+
[@tejasbubane]: https://github.com/tejasbubane
27+
[@knu]: https://github.com/knu
28+
[@amatsuda]: https://github.com/amatsuda
29+
[@koic]: https://github.com/koic
30+
[@jonas054]: https://github.com/jonas054
31+
[@bbatsov]: https://github.com/bbatsov
32+
[@piotrmurach]: https://github.com/piotrmurach
33+
[@dvandersluis]: https://github.com/dvandersluis
34+
[@marcandre]: https://github.com/marcandre

0 commit comments

Comments
 (0)