+78
-7
lines changedFilter options
+78
-7
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.75.7 (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.75.8 (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.75.8 (2025-05-28)
15
+
14
16
### Bug fixes
15
17
16
18
* [#14191](https://github.com/rubocop/rubocop/pull/14191): Fix `Lint/FloatComparison` cop to detect floating-point number comparisons in `case` statements. ([@daisuke][])
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.75.7 (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.75.8 (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
@@ -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.75'
6
6
nav:
7
7
- modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -702,6 +702,11 @@ Consider an example of code style that covers the following order:
702
702
* Private attribute macros (`attr_accessor`, `attr_writer`, `attr_reader`)
703
703
* Private instance methods
704
704
705
+
NOTE: Simply enabling the cop with `Enabled: true` will not use
706
+
the example order shown below.
707
+
To enforce the order of macros like `attr_reader`,
708
+
you must define both `ExpectedOrder` *and* `Categories`.
709
+
705
710
You can configure the following order:
706
711
707
712
[source,yaml]
@@ -748,6 +753,36 @@ automatically.
748
753
- extend
749
754
----
750
755
756
+
If you only set `ExpectedOrder`
757
+
without defining `Categories`,
758
+
macros such as `attr_reader` or `has_many`
759
+
will not be recognized as part of a category, and their order will not be validated.
760
+
For example, the following will NOT raise any offenses, even if the order is incorrect:
761
+
762
+
[source,yaml]
763
+
----
764
+
Layout/ClassStructure:
765
+
Enabled: true
766
+
ExpectedOrder:
767
+
- public_attribute_macros
768
+
- initializer
769
+
----
770
+
771
+
To make it work as expected, you must also specify `Categories` like this:
772
+
773
+
[source,yaml]
774
+
----
775
+
Layout/ClassStructure:
776
+
ExpectedOrder:
777
+
- public_attribute_macros
778
+
- initializer
779
+
Categories:
780
+
attribute_macros:
781
+
- attr_reader
782
+
- attr_writer
783
+
- attr_accessor
784
+
----
785
+
751
786
[#safety-layoutclassstructure]
752
787
=== Safety
753
788
Original file line number Diff line number Diff line change
@@ -2916,6 +2916,14 @@ if you perform any arithmetic operations involving precision loss.
2916
2916
x == 0.1
2917
2917
x != 0.1
2918
2918
2919
+
# bad
2920
+
case value
2921
+
when 1.0
2922
+
foo
2923
+
when 2.0
2924
+
bar
2925
+
end
2926
+
2919
2927
# good - using BigDecimal
2920
2928
x.to_d == 0.1.to_d
2921
2929
@@ -2933,6 +2941,14 @@ tolerance = 0.0001
2933
2941
# good - comparing against nil
2934
2942
Float(x, exception: false) == nil
2935
2943
2944
+
# good - using epsilon comparison in case expression
2945
+
case
2946
+
when (value - 1.0).abs < Float::EPSILON
2947
+
foo
2948
+
when (value - 2.0).abs < Float::EPSILON
2949
+
bar
2950
+
end
2951
+
2936
2952
# Or some other epsilon based type of comparison:
2937
2953
# https://www.embeddeduse.com/2019/08/26/qt-compare-two-floats/
2938
2954
----
Original file line number Diff line number Diff line change
@@ -3417,8 +3417,9 @@ def foo() = do_something
3417
3417
# good
3418
3418
def foo = do_something
3419
3419
3420
-
# good (without parentheses it's a syntax error)
3420
+
# good - without parentheses it's a syntax error
3421
3421
def foo() do_something end
3422
+
def foo()=do_something
3422
3423
3423
3424
# bad
3424
3425
def Baz.foo()
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ following to your `.pre-commit-config.yaml` file:
125
125
[source,yaml]
126
126
----
127
127
- repo: https://github.com/rubocop/rubocop
128
-
rev: v1.75.7
128
+
rev: v1.75.8
129
129
hooks:
130
130
- id: rubocop
131
131
----
@@ -136,7 +136,7 @@ entries in `additional_dependencies`:
136
136
[source,yaml]
137
137
----
138
138
- repo: https://github.com/rubocop/rubocop
139
-
rev: v1.75.7
139
+
rev: v1.75.8
140
140
hooks:
141
141
- id: rubocop
142
142
additional_dependencies:
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
3
3
module RuboCop
4
4
# This module holds the RuboCop version information.
5
5
module Version
6
-
STRING = '1.75.7'
6
+
STRING = '1.75.8'
7
7
8
8
MSG = '%<version>s (using %<parser_version>s, ' \
9
9
'rubocop-ast %<rubocop_ast_version>s, ' \
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1
+
### Bug fixes
2
+
3
+
* [#14191](https://github.com/rubocop/rubocop/pull/14191): Fix `Lint/FloatComparison` cop to detect floating-point number comparisons in `case` statements. ([@daisuke][])
4
+
* [#14209](https://github.com/rubocop/rubocop/pull/14209): Fix an error for `Style/RedundantFormat` with invalid format arguments. ([@earlopain][])
5
+
* [#14200](https://github.com/rubocop/rubocop/pull/14200): Fix false positives for `Style/DefWithParentheses` when using endless method definition with empty parentheses and a space before `=`. ([@koic][])
6
+
* [#14197](https://github.com/rubocop/rubocop/issues/14197): Fix infinite loop error for `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` and `Layout/HashAlignment`. ([@koic][])
7
+
* [#14204](https://github.com/rubocop/rubocop/pull/14204): Fix `Layout/EmptyLinesAroundAccessModifier` cop error on trailing access modifier. ([@viralpraxis][])
8
+
* [#14198](https://github.com/rubocop/rubocop/pull/14198): Fix `Lint/DuplicateMethods` cop error on `to` option is dynamically generated and `prefix` is enabled. ([@viralpraxis][])
9
+
* [#14199](https://github.com/rubocop/rubocop/pull/14199): Fix wrong autocorrection for `Style/MapToHash` with destructuring argument. ([@lovro-bikic][])
10
+
* [#14050](https://github.com/rubocop/rubocop/issues/14050): Modify condition for `rubocop:todo` EOL comment. ([@jonas054][])
11
+
12
+
[@daisuke]: https://github.com/daisuke
13
+
[@earlopain]: https://github.com/earlopain
14
+
[@koic]: https://github.com/koic
15
+
[@viralpraxis]: https://github.com/viralpraxis
16
+
[@lovro-bikic]: https://github.com/lovro-bikic
17
+
[@jonas054]: https://github.com/jonas054
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