rubocop-yard 0.9.2 → 0.10.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 +2 -0
- data/README.md +1 -1
- data/lib/rubocop/cop/yard/helper.rb +3 -1
- data/lib/rubocop/cop/yard/mismatch_name.rb +47 -22
- data/lib/rubocop/yard/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d73eb7a62e64e94aab37b8d19cb293aec7fbbaca2d3031cb88d082c75ed2d5e
|
4
|
+
data.tar.gz: e931eefce19747f89cb1a363dc56e6e5fb042a5ac6080823ec2655f17366a8eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02715af7b1f91e6a38bdc0fa265501cd1a2c47f5d2bde95ec0396ac97af2810e9deb2fcb740b1e326ba279dbfc062d27e2b34c0487e9b3624be14c88bc8142b
|
7
|
+
data.tar.gz: c1f6e29fb749cb49090e8b362333958e3b6192e02fc1375eb772e346cfaba6d4f631936e02b97d143f1839a0a441843ba0b5683e6e74fa298ceece3f22fc955e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -136,7 +136,7 @@ require: rubocop-yard
|
|
136
136
|
|
137
137
|
## Development
|
138
138
|
|
139
|
-
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.
|
139
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
140
140
|
|
141
141
|
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 then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
142
142
|
|
@@ -81,7 +81,9 @@ module RuboCop
|
|
81
81
|
minimum_space = comment_texts.map { |t| t.index(/[^\s]/) }.compact.min
|
82
82
|
yard_docstring = comment_texts.map { |t| t[minimum_space..-1] }.join("\n")
|
83
83
|
begin
|
84
|
-
::YARD::
|
84
|
+
::YARD::Logger.instance.enter_level(::YARD::Logger::ERROR) do
|
85
|
+
::YARD::DocstringParser.new.parse(yard_docstring)
|
86
|
+
end
|
85
87
|
rescue
|
86
88
|
nil
|
87
89
|
end
|
@@ -67,7 +67,7 @@ module RuboCop
|
|
67
67
|
|
68
68
|
# Documentation only or just `@return` is a common form of documentation.
|
69
69
|
# The subsequent features will be limited to cases where both `@param` and `@option` are present.
|
70
|
-
unless docstring.tags.find { |tag| (tag.tag_name == 'param' && !tag.instance_of?(::YARD::Tags::RefTagList)) || tag.tag_name == 'option' }
|
70
|
+
unless docstring.tags.find { |tag| (tag.tag_name == 'param' && !(tag.instance_of?(::YARD::Tags::RefTagList) && tag.name.nil?)) || tag.tag_name == 'option' }
|
71
71
|
return false
|
72
72
|
end
|
73
73
|
node.arguments.each do |argument|
|
@@ -97,28 +97,53 @@ module RuboCop
|
|
97
97
|
|
98
98
|
# @param [RuboCop::AST::ArgNode] argument
|
99
99
|
def tag_prototype(argument)
|
100
|
-
case argument.type
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
100
|
+
type = case argument.type
|
101
|
+
when :kwrestarg
|
102
|
+
"Hash{Symbol => Object}"
|
103
|
+
when :restarg
|
104
|
+
"Array<Object>"
|
105
|
+
when :optarg, :kwoptarg
|
106
|
+
literal_to_yard_type(argument.children.last)
|
107
|
+
else
|
108
|
+
"Object"
|
109
|
+
end
|
110
|
+
|
111
|
+
case cop_config_prototype_name
|
112
|
+
when "before"
|
113
|
+
"@param #{argument.name} [#{type}]"
|
114
|
+
when "after"
|
115
|
+
"@param [#{type}] #{argument.name}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def literal_to_yard_type(node)
|
120
|
+
case node.type
|
121
|
+
when :int
|
122
|
+
"Integer"
|
123
|
+
when :float
|
124
|
+
"Float"
|
125
|
+
when :rational
|
126
|
+
"Rational"
|
127
|
+
when :complex
|
128
|
+
"Complex"
|
129
|
+
when :str
|
130
|
+
"String"
|
131
|
+
when :true, :false
|
132
|
+
"Boolean"
|
133
|
+
when :sym
|
134
|
+
"Symbol"
|
135
|
+
when :array
|
136
|
+
"Array<Object>"
|
137
|
+
when :hash
|
138
|
+
"Hash{Symbol => Object}"
|
139
|
+
when :regexp
|
140
|
+
"Regexp"
|
141
|
+
when :irange, :erange
|
142
|
+
"Range[Object]"
|
143
|
+
when :nil
|
144
|
+
"Object, nil"
|
115
145
|
else
|
116
|
-
|
117
|
-
when "before"
|
118
|
-
"@param #{argument.name} [Object]"
|
119
|
-
when "after"
|
120
|
-
"@param [Object] #{argument.name}"
|
121
|
-
end
|
146
|
+
"Object"
|
122
147
|
end
|
123
148
|
end
|
124
149
|
|
data/lib/rubocop/yard/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.5.22
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Check yardoc format.
|