rubocop-yard 0.9.3 → 1.0.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 +6 -0
- data/README.md +2 -1
- data/lib/rubocop/cop/yard/mismatch_name.rb +46 -21
- data/lib/rubocop/yard/plugin.rb +31 -0
- data/lib/rubocop/yard/version.rb +1 -1
- data/lib/rubocop-yard.rb +1 -3
- metadata +21 -9
- data/lib/rubocop/yard/inject.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40bdb35bd0b95a6bc84afcf35b31d27acfb45eba7dae27862fef99b4fb961f29
|
4
|
+
data.tar.gz: 00341d80e3051ed88f0ecc390e463c5a6e2edc25f63a4d00ee1b1fba56d83ce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63811dcf428762af0afa33d0e237aa44b49846793ab7b19d66d4f5e5c1fd1484081e2b9a1b4ba999b535ea55572704369d484c4266bd28bd77117d9636f3b7c
|
7
|
+
data.tar.gz: a8c37ca47cfd1bd6dcc0a3f7d6e05f198ade8f7f530ba142593aee19be660c233912ff456f261162f9b9b98f2ed648f89b3cfe1ddce7b5e55f28d865e94bc9d8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -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
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module YARD
|
7
|
+
# A plugin that integrates RuboCop Performance with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: 'rubocop-yard',
|
12
|
+
version: VERSION,
|
13
|
+
homepage: 'https://github.com/ksss/rubocop-yard',
|
14
|
+
description: 'Check yardoc format like tag type.'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def supported?(context)
|
19
|
+
context.engine == :rubocop
|
20
|
+
end
|
21
|
+
|
22
|
+
def rules(_context)
|
23
|
+
LintRoller::Rules.new(
|
24
|
+
type: :path,
|
25
|
+
config_format: :rubocop,
|
26
|
+
value: Pathname.new(__dir__).join('../../../config/default.yml')
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/rubocop/yard/version.rb
CHANGED
data/lib/rubocop-yard.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: lint_roller
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '0'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '0'
|
13
26
|
- !ruby/object:Gem::Dependency
|
14
27
|
name: rubocop
|
15
28
|
requirement: !ruby/object:Gem::Requirement
|
16
29
|
requirements:
|
17
30
|
- - "~>"
|
18
31
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
32
|
+
version: '1.72'
|
20
33
|
type: :runtime
|
21
34
|
prerelease: false
|
22
35
|
version_requirements: !ruby/object:Gem::Requirement
|
23
36
|
requirements:
|
24
37
|
- - "~>"
|
25
38
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
39
|
+
version: '1.72'
|
27
40
|
- !ruby/object:Gem::Dependency
|
28
41
|
name: yard
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,7 +74,7 @@ files:
|
|
61
74
|
- lib/rubocop/cop/yard/tag_type_syntax.rb
|
62
75
|
- lib/rubocop/cop/yard_cops.rb
|
63
76
|
- lib/rubocop/yard.rb
|
64
|
-
- lib/rubocop/yard/
|
77
|
+
- lib/rubocop/yard/plugin.rb
|
65
78
|
- lib/rubocop/yard/version.rb
|
66
79
|
- sig/rubocop/yard.rbs
|
67
80
|
homepage: https://github.com/ksss/rubocop-yard
|
@@ -72,7 +85,7 @@ metadata:
|
|
72
85
|
source_code_uri: https://github.com/ksss/rubocop-yard
|
73
86
|
changelog_uri: https://github.com/ksss/rubocop-yard
|
74
87
|
rubygems_mfa_required: 'true'
|
75
|
-
|
88
|
+
default_lint_roller_plugin: RuboCop::YARD::Plugin
|
76
89
|
rdoc_options: []
|
77
90
|
require_paths:
|
78
91
|
- lib
|
@@ -87,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
100
|
- !ruby/object:Gem::Version
|
88
101
|
version: '0'
|
89
102
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
91
|
-
signing_key:
|
103
|
+
rubygems_version: 3.7.0.dev
|
92
104
|
specification_version: 4
|
93
105
|
summary: Check yardoc format.
|
94
106
|
test_files: []
|
data/lib/rubocop/yard/inject.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
4
|
-
# See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
|
5
|
-
module RuboCop
|
6
|
-
module YARD
|
7
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
|
-
# bit of our configuration.
|
9
|
-
module Inject
|
10
|
-
def self.defaults!
|
11
|
-
path = CONFIG_DEFAULT.to_s
|
12
|
-
hash = ConfigLoader.send(:load_yaml_configuration, path)
|
13
|
-
config = Config.new(hash, path).tap(&:make_excludes_absolute)
|
14
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
15
|
-
config = ConfigLoader.merge_with_default(config, path)
|
16
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|