rubocop-rbs 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -5
- data/lib/rubocop/cop/rbs/method_signature.rb +1 -1
- data/lib/rubocop/rbs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7053fde02f4e277c641087d31f649ab76b8f017d9f789d72ce1eccdabffe0c8c
|
4
|
+
data.tar.gz: ffe77e48590facabf35d3e06d5d8c3d369d0bbe96d3778113dc293a18b55db33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f3bbb652c3834d9ee604f58a35782d442ef82aae6c484f879983d4dd26b2822f213fd92bcc64fd6e04b414776010238a278ce6bc199da48c0bf9adf5c06671e
|
7
|
+
data.tar.gz: 6a66ed9bbd891c9cea8cab5c55f85ccbef0d1966ec65dee374f0d2e39eff89c939e0d0f2c73542dee0d35897440f917e7aac5da91fc0684993575f0b738ddc65
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# RuboCop RBS
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rubocop-rbs.svg)](https://badge.fury.io/rb/rubocop-rbs)
|
4
|
+
|
3
5
|
RucoCop extension that check RBS signatures.
|
4
6
|
|
5
7
|
> DISCLAIMER: this extension is an ALPHA version, it could be not 100% stable
|
@@ -15,17 +17,49 @@ Please ⭐ if you like it.
|
|
15
17
|
|
16
18
|
## Install
|
17
19
|
|
18
|
-
- Add to
|
20
|
+
- Add to _Gemfile_: `gem 'rubocop-rbs', '~> 0.1.1'` (and execute bundle);
|
21
|
+
- Add to _.rubocop.yml_:
|
19
22
|
|
20
|
-
|
23
|
+
```yml
|
24
|
+
require:
|
25
|
+
- rubocop-rbs
|
26
|
+
```
|
21
27
|
|
22
|
-
|
28
|
+
## Usage
|
23
29
|
|
24
|
-
|
30
|
+
- Execute rubocop: `bundle exec rubocop`
|
31
|
+
- To skip the cop from some files:
|
25
32
|
|
26
33
|
```yml
|
27
34
|
Rbs/MethodSignature:
|
28
|
-
|
35
|
+
Exclude:
|
36
|
+
- main.rb
|
37
|
+
```
|
38
|
+
|
39
|
+
## Offenses
|
40
|
+
|
41
|
+
- _Rbs/MethodSignature: signature error_: one or more signature errors in a RBS file:
|
42
|
+
|
43
|
+
```
|
44
|
+
main.rb:7:3: C: Rbs/MethodSignature: signature error, sig/main.rbs:1:0...1:3: Syntax error: cannot start a declaration, token=def (kDEF)
|
45
|
+
def test_required_positionals(key1, key2); end
|
46
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
47
|
+
```
|
48
|
+
|
49
|
+
- _Rbs/MethodSignature: missing signature_: method signature not found in the RBS files:
|
50
|
+
|
51
|
+
```
|
52
|
+
main.rb:7:3: C: Rbs/MethodSignature: missing signature
|
53
|
+
def test_required_positionals(key1, key2); end
|
54
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
55
|
+
```
|
56
|
+
|
57
|
+
- _Rbs/MethodSignature: signature mismatch_: method signature has different arguments from the one defined in the RBS files:
|
58
|
+
|
59
|
+
```
|
60
|
+
main.rb:7:3: C: Rbs/MethodSignature: signature mismatch, expected: (untyped, untyped, untyped) -> void
|
61
|
+
def test_required_positionals(key1, key2); end
|
62
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
29
63
|
```
|
30
64
|
|
31
65
|
## Do you like it? Star it!
|
@@ -74,7 +74,7 @@ module RuboCop
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def arity_arg_match?(arity, rbs_args)
|
77
|
-
arity[:arg].to_i == rbs_args.required_positionals.count
|
77
|
+
arity[:arg].to_i == (rbs_args.required_positionals.count + rbs_args.trailing_positionals.count)
|
78
78
|
end
|
79
79
|
|
80
80
|
def arity_optarg_match?(arity, rbs_args)
|
data/lib/rubocop/rbs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs
|