rubocop-on-rbs 1.5.0 → 1.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 442a7571452e14e42efbd73d0f0313f983f631a983fd5c861f5c54d333538fd6
|
4
|
+
data.tar.gz: 1803e6bdf3eb67a025a3d1286966bef98eb695cf16e7edf83a717d748f995eca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '037319b5e7725a91470530891915c93227eddf4899ad8ad1a332f23bf23c3abedfc47f34618fbaa5c9672ad37d3e0badd32c7dec13f6319622dd653726f0d76d'
|
7
|
+
data.tar.gz: f2009c6f0af208cb65f96d410461c435f5a5a919253f191af1ae58f96ab54137e95c1e56d433aaac474126cbe7740a8320fd475c5d5487277ec47c0f92b46c30
|
data/README.md
CHANGED
@@ -33,20 +33,10 @@ def foo: ( void) -> untyped
|
|
33
33
|
|
34
34
|
## Support VSCode
|
35
35
|
|
36
|
-
|
36
|
+
[vscode-rubocop](https://github.com/rubocop/vscode-rubocop) with [rubocop.additionalLanguages](https://github.com/rubocop/vscode-rubocop?tab=readme-ov-file#rubocopadditionallanguages) option is recommended.
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
```
|
41
|
-
$ code ~/.vscode/extensions/rubocop.vscode-rubocop-X.Y.Z/
|
42
|
-
```
|
43
|
-
|
44
|
-
Search `documentSelector:[{`.
|
45
|
-
|
46
|
-
Then, Edit to add following to `documentSelector[]`
|
47
|
-
|
48
|
-
```js
|
49
|
-
{scheme:"file",language:"rbs"}
|
38
|
+
```json
|
39
|
+
"rubocop.additionalLanguages": ["rbs"]
|
50
40
|
```
|
51
41
|
|
52
42
|
Additionally, by configuring the `settings.json` below, you can enable auto-correction to run on file save.
|
@@ -25,6 +25,12 @@ module RuboCop
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def on_rbs_constant(decl) = check_type(decl.type)
|
29
|
+
alias on_rbs_global on_rbs_constant
|
30
|
+
alias on_rbs_type_alias on_rbs_constant
|
31
|
+
alias on_rbs_attribute on_rbs_constant
|
32
|
+
alias on_rbs_var on_rbs_constant
|
33
|
+
|
28
34
|
# @rbs type: ::RBS::Types::t
|
29
35
|
def check_type(type)
|
30
36
|
case type
|
@@ -17,16 +17,26 @@ module RuboCop
|
|
17
17
|
def on_rbs_def(decl)
|
18
18
|
decl.overloads.each do |overload|
|
19
19
|
overload.method_type.each_type do |type|
|
20
|
-
|
21
|
-
range = location_to_range(t.location)
|
22
|
-
add_offense(range, message: "Use `#{replaced}` instead of `#{t}`") do |corrector|
|
23
|
-
corrector.replace(range, replaced.to_s)
|
24
|
-
end
|
25
|
-
end
|
20
|
+
check_type(type)
|
26
21
|
end
|
27
22
|
end
|
28
23
|
end
|
29
24
|
|
25
|
+
def check_type(type)
|
26
|
+
find_replacement(type) do |t, replaced|
|
27
|
+
range = location_to_range(t.location)
|
28
|
+
add_offense(range, message: "Use `#{replaced}` instead of `#{t}`") do |corrector|
|
29
|
+
corrector.replace(range, replaced.to_s)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_rbs_constant(const) = check_type(const.type)
|
35
|
+
alias on_rbs_global on_rbs_constant
|
36
|
+
alias on_rbs_type_alias on_rbs_constant
|
37
|
+
alias on_rbs_attribute on_rbs_constant
|
38
|
+
alias on_rbs_var on_rbs_constant
|
39
|
+
|
30
40
|
# @rbs type: ::RBS::Types::t
|
31
41
|
def find_replacement(type, &block)
|
32
42
|
case type
|
@@ -20,12 +20,22 @@ module RuboCop
|
|
20
20
|
def on_rbs_def(decl)
|
21
21
|
decl.overloads.each do |overload|
|
22
22
|
overload.method_type.each_type do |type|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
check_type(type)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def on_rbs_constant(const) = check_type(const.type)
|
29
|
+
alias on_rbs_global on_rbs_constant
|
30
|
+
alias on_rbs_type_alias on_rbs_constant
|
31
|
+
alias on_rbs_attribute on_rbs_constant
|
32
|
+
alias on_rbs_var on_rbs_constant
|
33
|
+
|
34
|
+
def check_type(type)
|
35
|
+
find_replacement(type) do |t, replaced|
|
36
|
+
range = location_to_range(t.location)
|
37
|
+
add_offense(range, message: "Use `#{replaced}` instead of `#{t}`") do |corrector|
|
38
|
+
corrector.replace(range, replaced.to_s)
|
29
39
|
end
|
30
40
|
end
|
31
41
|
end
|
data/lib/rubocop/rbs/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-on-rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: lint_roller
|