rubocop-yard 0.7.0 → 0.8.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: 903402913fde5bdf6702b4412bc6f1ab07197f5f993039c440ffd1a736b5277c
4
- data.tar.gz: 31eeffd0cbd9fd26fe3cf5035784c990bea7e9296e10cbb22a36218c31064db9
3
+ metadata.gz: 64ff6712be966753c2ddc2510a4a51c1d36488ed302b8fc848f50e8beb6561b5
4
+ data.tar.gz: a34143c5775f3705adb8bd4aac2837b4c4b2334f7191ccc2c7629b015cd3fe89
5
5
  SHA512:
6
- metadata.gz: 48d2bd70f00ffd7c31e864039b77b9eabaff53e52b25c8825959c25486f024e3f3d63827ba98dc8ea5f09dd6a964e93700eaa1f88ef1ec6746d46804026bd444
7
- data.tar.gz: 7f4e6010137fd5f1c55b70c9c6744f4ca194e6a44078aca0643020bd0ba1c9b43b7cec3cea1790eff025f79990cedb443e75b737d292095fba0896f5b0f17b68
6
+ metadata.gz: 1bdf6a2b0740459083c5e1b0e93ecab91172b372821168972879f94bb3b59c21706a0eb84895d03cf6ce915ab25b510100c8c84edd7cecd8469d8b6950647cc0
7
+ data.tar.gz: 89d4dd145df3813f14e4f3fb790e892c1948858843a8ab1b834450c6eac52164f5d222ebc8c8dcd3db3589d23e0b82ae599a9247e60f41d3697b82c8e0157c44
data/config/default.yml CHANGED
@@ -30,3 +30,8 @@ YARD/MismatchName:
30
30
  Description: 'Check @param and @option name and method parameters'
31
31
  Enabled: true
32
32
  VersionAdded: '0.3.0'
33
+ EnforcedStylePrototypeName: after
34
+ SupportedStylesPrototypeName:
35
+ - before
36
+ - after
37
+
@@ -102,11 +102,34 @@ module RuboCop
102
102
  def tag_prototype(argument)
103
103
  case argument.type
104
104
  when :kwrestarg
105
- "@param [Hash{Symbol => Object}] #{argument.name}"
105
+ case cop_config_prototype_name
106
+ when "before"
107
+ "@param #{argument.name} [Hash{Symbol => Object}]"
108
+ when "after"
109
+ "@param [Hash{Symbol => Object}] #{argument.name}"
110
+ end
106
111
  when :restarg
107
- "@param [Array<Object>] #{argument.name}"
112
+ case cop_config_prototype_name
113
+ when "before"
114
+ "@param #{argument.name} [Array<Object>]"
115
+ when "after"
116
+ "@param [Array<Object>] #{argument.name}"
117
+ end
108
118
  else
109
- "@param [Object] #{argument.name}"
119
+ case cop_config_prototype_name
120
+ when "before"
121
+ "@param #{argument.name} [Object]"
122
+ when "after"
123
+ "@param [Object] #{argument.name}"
124
+ end
125
+ end
126
+ end
127
+
128
+ def cop_config_prototype_name
129
+ @cop_config_prototype_name ||= cop_config["EnforcedStylePrototypeName"].tap do |c|
130
+ unless cop_config["SupportedStylesPrototypeName"].include?(c)
131
+ raise "unsupported style #{c}"
132
+ end
110
133
  end
111
134
  end
112
135
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Support for rubocop v1.46.0 or under.
4
+ # see also https://github.com/rubocop/rubocop/pull/11630
5
+ return if defined? RuboCop::Ext::Comment
6
+
7
+ module RuboCop
8
+ module Ext
9
+ # Extensions to `Parser::Source::Comment`.
10
+ module Comment
11
+ def source
12
+ loc.expression.source
13
+ end
14
+
15
+ def source_range
16
+ loc.expression
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ Parser::Source::Comment.include RuboCop::Ext::Comment
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'yard'
4
+ require_relative 'yard/patch'
4
5
  require_relative 'yard/helper'
5
6
  require_relative 'yard/collection_style'
6
7
  require_relative 'yard/collection_type'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module YARD
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-14 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.21'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.21'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +56,7 @@ files:
56
56
  - lib/rubocop/cop/yard/helper.rb
57
57
  - lib/rubocop/cop/yard/meaningless_tag.rb
58
58
  - lib/rubocop/cop/yard/mismatch_name.rb
59
+ - lib/rubocop/cop/yard/patch.rb
59
60
  - lib/rubocop/cop/yard/tag_type_syntax.rb
60
61
  - lib/rubocop/cop/yard_cops.rb
61
62
  - lib/rubocop/yard.rb