rubocop-rails_deprecation 0.1.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -0
- data/config/default.yml +3 -3
- data/lib/rubocop/cop/rails_deprecation/base.rb +1 -1
- data/lib/rubocop/cop/rails_deprecation/to_formatted_s.rb +9 -5
- data/lib/rubocop/rails_deprecation/inject.rb +1 -1
- data/lib/rubocop/rails_deprecation/version.rb +2 -2
- data/lib/rubocop/rails_deprecation.rb +1 -1
- data/lib/rubocop-rails_deprecation.rb +1 -1
- data/rubocop-rails_deprecation.gemspec +1 -1
- metadata +2 -3
- data/sig/rubocop/rails_deprecation.rbs +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df33d530f4332c047cc6a14af980d43085e74136a2b74221d94aad9d8ad5b43b
|
4
|
+
data.tar.gz: f0755472fffc30564bd332d9a21ec807cf3c34a43cbffc902ee205f7bfc441d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2a4359d066d4db18317083cd458a94a37a288ec76864f8a2ff07fbf9d9443ed5500d826a3de27a72c219a8be5d3c2c71495f8e5e4762c6960996f489f211a57
|
7
|
+
data.tar.gz: 55c84e4f33eb00bc015651f06e1801ba6865d5751a7f0dc6c1ea6aa108eda992f3f135b95e8cba31baca6b42c34910b67ebdad240042004e84104d8fea5aa8e2
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 0.4.0
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Support csend on RailsDeprecation/ToFormattedS.
|
10
|
+
|
11
|
+
## 0.3.0
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
|
15
|
+
- Rename RailsDeprecation/ToFormattedS with Deprecation/ToFormattedS.
|
16
|
+
- Enable cop by default.
|
17
|
+
|
18
|
+
## 0.2.0
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
|
22
|
+
- Make #to_fs the default replacement for #to_s(:format).
|
23
|
+
|
5
24
|
## 0.1.0
|
6
25
|
|
7
26
|
### Added
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# rubocop-rails_deprecation
|
2
2
|
|
3
|
+
[](https://github.com/r7kamura/rubocop-rails_deprecation/actions/workflows/test.yml)
|
4
|
+
[](https://rubygems.org/gems/rubocop-rails_deprecation)
|
5
|
+
|
3
6
|
RuboCop extension for Rails deprecation.
|
4
7
|
|
5
8
|
## Installation
|
@@ -21,3 +24,11 @@ Or install it yourself as:
|
|
21
24
|
```
|
22
25
|
gem install rubocop-rails_deprecation
|
23
26
|
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
```yaml
|
31
|
+
# .rubocop.yml
|
32
|
+
require:
|
33
|
+
- rubocop-rails_deprecation
|
34
|
+
```
|
data/config/default.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
Description: Use `
|
3
|
-
Enabled:
|
1
|
+
Deprecation/ToFormattedS:
|
2
|
+
Description: Use `to_fs(...)` instead of `to_s(...)`.
|
3
|
+
Enabled: true
|
4
4
|
VersionAdded: '0.1'
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
|
-
module
|
5
|
+
module Deprecation
|
6
6
|
# This cop identifies passing a format to `#to_s`.
|
7
7
|
#
|
8
8
|
# @safety
|
9
|
-
# This cop's auto-correction is unsafe because a custom or unrelated `to_s` method call would be change to `
|
9
|
+
# This cop's auto-correction is unsafe because a custom or unrelated `to_s` method call would be change to `to_fs`.
|
10
10
|
#
|
11
11
|
# @example
|
12
12
|
#
|
@@ -14,6 +14,9 @@ module RuboCop
|
|
14
14
|
# to_s(:delimited)
|
15
15
|
#
|
16
16
|
# # good
|
17
|
+
# to_fs(:delimited)
|
18
|
+
#
|
19
|
+
# # good
|
17
20
|
# to_formatted_s(:delimited)
|
18
21
|
#
|
19
22
|
# # good
|
@@ -24,10 +27,10 @@ module RuboCop
|
|
24
27
|
|
25
28
|
self.minimum_target_rails_version = 7.0
|
26
29
|
|
27
|
-
MSG = 'Use `
|
30
|
+
MSG = 'Use `to_fs(...)` instead of `to_s(...)`.'
|
28
31
|
|
29
32
|
def_node_matcher :to_s_with_any_argument?, <<~PATTERN
|
30
|
-
(send _ :to_s _ ...)
|
33
|
+
({csend | send} _ :to_s _ ...)
|
31
34
|
PATTERN
|
32
35
|
|
33
36
|
def on_send(node)
|
@@ -36,10 +39,11 @@ module RuboCop
|
|
36
39
|
add_offense(node) do |rewriter|
|
37
40
|
rewriter.replace(
|
38
41
|
node.loc.selector,
|
39
|
-
'
|
42
|
+
'to_fs'
|
40
43
|
)
|
41
44
|
end
|
42
45
|
end
|
46
|
+
alias on_csend on_send
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/main/lib/rubocop/rspec/inject.rb
|
4
4
|
# See https://github.com/rubocop/rubocop-rspec/blob/main/MIT-LICENSE.md
|
5
5
|
module RuboCop
|
6
|
-
module
|
6
|
+
module Deprecation
|
7
7
|
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
8
|
# bit of our configuration.
|
9
9
|
module Inject
|
@@ -6,6 +6,6 @@ require_relative 'rubocop/rails_deprecation'
|
|
6
6
|
require_relative 'rubocop/rails_deprecation/version'
|
7
7
|
require_relative 'rubocop/rails_deprecation/inject'
|
8
8
|
|
9
|
-
RuboCop::
|
9
|
+
RuboCop::Deprecation::Inject.defaults!
|
10
10
|
|
11
11
|
require_relative 'rubocop/cop/rails_deprecation_cops'
|
@@ -4,7 +4,7 @@ require_relative 'lib/rubocop/rails_deprecation/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'rubocop-rails_deprecation'
|
7
|
-
spec.version = RuboCop::
|
7
|
+
spec.version = RuboCop::Deprecation::VERSION
|
8
8
|
spec.authors = ['Ryo Nakamura']
|
9
9
|
spec.email = ['r7kamura@gmail.com']
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails_deprecation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- lib/rubocop/rails_deprecation/inject.rb
|
50
50
|
- lib/rubocop/rails_deprecation/version.rb
|
51
51
|
- rubocop-rails_deprecation.gemspec
|
52
|
-
- sig/rubocop/rails_deprecation.rbs
|
53
52
|
homepage: https://github.com/r7kamura/rubocop-rails_deprecation
|
54
53
|
licenses:
|
55
54
|
- MIT
|