rubocop-rbs_inline 1.1.0 → 1.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 +4 -4
- data/.vscode/settings.json +3 -1
- data/README.md +12 -13
- data/lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb +8 -4
- data/lib/rubocop/rbs_inline/version.rb +1 -1
- data/rbs_collection.lock.yaml +11 -11
- data/sig/rubocop/cop/style/rbs_inline/unmatched_annotations.rbs +4 -2
- 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: 4b33ed6ff1d6efff790de931d74d2663e0ca262a761d063114e486948828e9ca
|
4
|
+
data.tar.gz: 2d5678da5232ff06102653fc68a89ced09554eec6a048cc1f6dee322d37228e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a6c443fbc4e058be3aca4ccc5b3e25068b139095c01994bfcd8ea62b406701f44fa5b4b643d7a23902e5c4a7d754b4fb5f741f0f0706ab36bc8cd465801751e
|
7
|
+
data.tar.gz: c6fcb3f88b5685f0a20e7a0c90f723ba4dabd14a029e10585c61bea64258ec29304b53b3e7db3ed962365abacfc21860ef1e65866eacc89b28efcf3aeaae9360
|
data/.vscode/settings.json
CHANGED
data/README.md
CHANGED
@@ -1,38 +1,37 @@
|
|
1
|
-
#
|
1
|
+
# rubocop-rbs_inline
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rubocop/rbs_inline`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
rubocop-rbs_inline is a RuboCop extension that checks for [RBS::Inline](https://github.com/soutaro/rbs-inline) annotation comments in Ruby code.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
7
|
Install the gem and add to the application's Gemfile by executing:
|
12
8
|
|
13
9
|
```bash
|
14
|
-
bundle add
|
10
|
+
bundle add rubocop-rbs_inline
|
15
11
|
```
|
16
12
|
|
17
13
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
18
14
|
|
19
15
|
```bash
|
20
|
-
gem install
|
16
|
+
gem install rubocop-rbs_inline
|
21
17
|
```
|
22
18
|
|
23
|
-
|
19
|
+
Add the following to your `.rubocop.yml`:
|
24
20
|
|
25
|
-
|
21
|
+
```
|
22
|
+
require:
|
23
|
+
- rubocop-rbs_inline
|
24
|
+
```
|
26
25
|
|
27
26
|
## Development
|
28
27
|
|
29
28
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
29
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and
|
30
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and add Git tag named `vX.Y.Z` and push it to the GitHub. Then GitHub Actions will be release the package to [rubygems.org](https://rubygems.org).
|
32
31
|
|
33
32
|
## Contributing
|
34
33
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tk0miya/rubocop-rbs_inline. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/tk0miya/rubocop-rbs_inline/blob/main/CODE_OF_CONDUCT.md).
|
36
35
|
|
37
36
|
## License
|
38
37
|
|
@@ -40,4 +39,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
39
|
|
41
40
|
## Code of Conduct
|
42
41
|
|
43
|
-
Everyone interacting in the
|
42
|
+
Everyone interacting in the rubocop-rbs_inline project's codebases and issue trackers is expected to follow the [code of conduct](https://github.com/tk0miya/rubocop-rbs_inline/blob/main/CODE_OF_CONDUCT.md).
|
@@ -43,9 +43,9 @@ module RuboCop
|
|
43
43
|
result.each do |comment|
|
44
44
|
comment.each_annotation do |annotation|
|
45
45
|
case annotation
|
46
|
-
when RBS::Inline::AST::Annotations::
|
47
|
-
|
48
|
-
|
46
|
+
when RBS::Inline::AST::Annotations::BlockType,
|
47
|
+
RBS::Inline::AST::Annotations::ReturnType,
|
48
|
+
RBS::Inline::AST::Annotations::VarType
|
49
49
|
add_offense_for(annotation)
|
50
50
|
end
|
51
51
|
end
|
@@ -57,7 +57,7 @@ module RuboCop
|
|
57
57
|
private
|
58
58
|
|
59
59
|
# @rbs node: Parser::AST::Node
|
60
|
-
def process(node) #: void
|
60
|
+
def process(node) #: void # rubocop:disable Metrics/CyclomaticComplexity
|
61
61
|
arguments = arguments_for(node)
|
62
62
|
|
63
63
|
comment = result.find { |r| r.comments.map(&:location).map(&:start_line).include? node.location.line - 1 }
|
@@ -66,6 +66,8 @@ module RuboCop
|
|
66
66
|
result.delete(comment)
|
67
67
|
comment.each_annotation do |annotation|
|
68
68
|
case annotation
|
69
|
+
when RBS::Inline::AST::Annotations::IvarType
|
70
|
+
add_offense_for(annotation)
|
69
71
|
when RBS::Inline::AST::Annotations::VarType, RBS::Inline::AST::Annotations::BlockType
|
70
72
|
add_offense_for(annotation) unless arguments.include?(annotation_name(annotation))
|
71
73
|
end
|
@@ -119,6 +121,7 @@ module RuboCop
|
|
119
121
|
end
|
120
122
|
|
121
123
|
# @rbs annotation: RBS::Inline::AST::Annotations::BlockType |
|
124
|
+
# RBS::Inline::AST::Annotations::IvarType |
|
122
125
|
# RBS::Inline::AST::Annotations::ReturnType |
|
123
126
|
# RBS::Inline::AST::Annotations::VarType
|
124
127
|
def annotation_name(annotation) #: String
|
@@ -133,6 +136,7 @@ module RuboCop
|
|
133
136
|
end
|
134
137
|
|
135
138
|
# @rbs annotation: RBS::Inline::AST::Annotations::BlockType |
|
139
|
+
# RBS::Inline::AST::Annotations::IvarType |
|
136
140
|
# RBS::Inline::AST::Annotations::ReturnType |
|
137
141
|
# RBS::Inline::AST::Annotations::VarType
|
138
142
|
def add_offense_for(annotation) #: void # rubocop:disable Metrics/AbcSize
|
data/rbs_collection.lock.yaml
CHANGED
@@ -6,7 +6,7 @@ gems:
|
|
6
6
|
source:
|
7
7
|
type: git
|
8
8
|
name: ruby/gem_rbs_collection
|
9
|
-
revision:
|
9
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
10
10
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
11
11
|
repo_dir: gems
|
12
12
|
- name: dbm
|
@@ -18,7 +18,7 @@ gems:
|
|
18
18
|
source:
|
19
19
|
type: git
|
20
20
|
name: ruby/gem_rbs_collection
|
21
|
-
revision:
|
21
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
22
22
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
23
23
|
repo_dir: gems
|
24
24
|
- name: fileutils
|
@@ -46,7 +46,7 @@ gems:
|
|
46
46
|
source:
|
47
47
|
type: git
|
48
48
|
name: ruby/gem_rbs_collection
|
49
|
-
revision:
|
49
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
50
50
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
51
51
|
repo_dir: gems
|
52
52
|
- name: parser
|
@@ -54,7 +54,7 @@ gems:
|
|
54
54
|
source:
|
55
55
|
type: git
|
56
56
|
name: ruby/gem_rbs_collection
|
57
|
-
revision:
|
57
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
58
58
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
59
59
|
repo_dir: gems
|
60
60
|
- name: pathname
|
@@ -78,7 +78,7 @@ gems:
|
|
78
78
|
source:
|
79
79
|
type: git
|
80
80
|
name: ruby/gem_rbs_collection
|
81
|
-
revision:
|
81
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
82
82
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
83
83
|
repo_dir: gems
|
84
84
|
- name: rake
|
@@ -86,15 +86,15 @@ gems:
|
|
86
86
|
source:
|
87
87
|
type: git
|
88
88
|
name: ruby/gem_rbs_collection
|
89
|
-
revision:
|
89
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
90
90
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
91
91
|
repo_dir: gems
|
92
92
|
- name: rbs
|
93
|
-
version: 3.
|
93
|
+
version: 3.6.1
|
94
94
|
source:
|
95
95
|
type: rubygems
|
96
96
|
- name: rbs-inline
|
97
|
-
version: 0.
|
97
|
+
version: 0.9.0
|
98
98
|
source:
|
99
99
|
type: rubygems
|
100
100
|
- name: rdoc
|
@@ -106,7 +106,7 @@ gems:
|
|
106
106
|
source:
|
107
107
|
type: git
|
108
108
|
name: ruby/gem_rbs_collection
|
109
|
-
revision:
|
109
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
110
110
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
111
111
|
repo_dir: gems
|
112
112
|
- name: rubocop
|
@@ -114,7 +114,7 @@ gems:
|
|
114
114
|
source:
|
115
115
|
type: git
|
116
116
|
name: ruby/gem_rbs_collection
|
117
|
-
revision:
|
117
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
118
118
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
119
119
|
repo_dir: gems
|
120
120
|
- name: rubocop-ast
|
@@ -122,7 +122,7 @@ gems:
|
|
122
122
|
source:
|
123
123
|
type: git
|
124
124
|
name: ruby/gem_rbs_collection
|
125
|
-
revision:
|
125
|
+
revision: ddba0c60808c22451a194c1b57504fceb4fafd23
|
126
126
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
127
127
|
repo_dir: gems
|
128
128
|
- name: strscan
|
@@ -45,14 +45,16 @@ module RuboCop
|
|
45
45
|
def parse_comments: () -> Array[RBS::Inline::AnnotationParser::ParsingResult]
|
46
46
|
|
47
47
|
# @rbs annotation: RBS::Inline::AST::Annotations::BlockType |
|
48
|
+
# RBS::Inline::AST::Annotations::IvarType |
|
48
49
|
# RBS::Inline::AST::Annotations::ReturnType |
|
49
50
|
# RBS::Inline::AST::Annotations::VarType
|
50
|
-
def annotation_name: (RBS::Inline::AST::Annotations::BlockType | RBS::Inline::AST::Annotations::ReturnType | RBS::Inline::AST::Annotations::VarType annotation) -> String
|
51
|
+
def annotation_name: (RBS::Inline::AST::Annotations::BlockType | RBS::Inline::AST::Annotations::IvarType | RBS::Inline::AST::Annotations::ReturnType | RBS::Inline::AST::Annotations::VarType annotation) -> String
|
51
52
|
|
52
53
|
# @rbs annotation: RBS::Inline::AST::Annotations::BlockType |
|
54
|
+
# RBS::Inline::AST::Annotations::IvarType |
|
53
55
|
# RBS::Inline::AST::Annotations::ReturnType |
|
54
56
|
# RBS::Inline::AST::Annotations::VarType
|
55
|
-
def add_offense_for: (RBS::Inline::AST::Annotations::BlockType | RBS::Inline::AST::Annotations::ReturnType | RBS::Inline::AST::Annotations::VarType annotation) -> void
|
57
|
+
def add_offense_for: (RBS::Inline::AST::Annotations::BlockType | RBS::Inline::AST::Annotations::IvarType | RBS::Inline::AST::Annotations::ReturnType | RBS::Inline::AST::Annotations::VarType annotation) -> void
|
56
58
|
|
57
59
|
# @rbs byte_offset: Integer
|
58
60
|
def character_offset: (Integer byte_offset) -> Integer
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rbs_inline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi KOMIYA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbs-inline
|