rubocop-rbs 0.1.0 → 0.1.1

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: 8d4c9bb32e6323c9c18f2b096da62d0e22e18be953d63aaa5604a2dd08861af7
4
- data.tar.gz: 9b593cc7039f03b3cc07635fd0b25a465d404289decabe459befe45c1431efa5
3
+ metadata.gz: 7053fde02f4e277c641087d31f649ab76b8f017d9f789d72ce1eccdabffe0c8c
4
+ data.tar.gz: ffe77e48590facabf35d3e06d5d8c3d369d0bbe96d3778113dc293a18b55db33
5
5
  SHA512:
6
- metadata.gz: 5f8b812d5aa182a68e3ca9e4da6cc0e48df67b43851f32f0b740a3d1e29c0095b0c6f4d949374c0ff195e8019c7014bcf9b7add13a76473d1b5f5963decd8a13
7
- data.tar.gz: 6ffd5e997d7995e223cf9de22b0f56b29b4de840965e84881ac00140f0095c818d6391e42e596508051d19c8a3c24882b040516fc5fd38d0384fd2ea8a6a94b6
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 your Gemfile: `gem 'rubocop-rbs'` (and execute bundle)
20
+ - Add to _Gemfile_: `gem 'rubocop-rbs', '~> 0.1.1'` (and execute bundle);
21
+ - Add to _.rubocop.yml_:
19
22
 
20
- ## Usage
23
+ ```yml
24
+ require:
25
+ - rubocop-rbs
26
+ ```
21
27
 
22
- - Execute `rubocop`
28
+ ## Usage
23
29
 
24
- To disable the cop:
30
+ - Execute rubocop: `bundle exec rubocop`
31
+ - To skip the cop from some files:
25
32
 
26
33
  ```yml
27
34
  Rbs/MethodSignature:
28
- Enabled: false
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Rbs
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
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.0
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-02 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbs