yard-lint 1.2.2 → 1.3.0.rc1
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 +174 -1
- data/README.md +118 -3
- data/Rakefile +20 -0
- data/bin/yard-lint +80 -37
- data/lib/yard/lint/config.rb +5 -0
- data/lib/yard/lint/config_generator.rb +8 -179
- data/lib/yard/lint/config_updater.rb +222 -0
- data/lib/yard/lint/errors.rb +6 -0
- data/lib/yard/lint/executor/in_process_registry.rb +130 -0
- data/lib/yard/lint/executor/query_executor.rb +109 -0
- data/lib/yard/lint/executor/result_collector.rb +55 -0
- data/lib/yard/lint/executor/warning_dispatcher.rb +79 -0
- data/lib/yard/lint/results/base.rb +2 -1
- data/lib/yard/lint/runner.rb +88 -35
- data/lib/yard/lint/stats_calculator.rb +1 -1
- data/lib/yard/lint/templates/default_config.yml +279 -0
- data/lib/yard/lint/templates/strict_config.yml +283 -0
- data/lib/yard/lint/validators/base.rb +52 -118
- data/lib/yard/lint/validators/documentation/blank_line_before_definition/config.rb +25 -0
- data/lib/yard/lint/validators/documentation/blank_line_before_definition/messages_builder.rb +39 -0
- data/lib/yard/lint/validators/documentation/blank_line_before_definition/parser.rb +59 -0
- data/lib/yard/lint/validators/documentation/blank_line_before_definition/result.rb +61 -0
- data/lib/yard/lint/validators/documentation/blank_line_before_definition/validator.rb +94 -0
- data/lib/yard/lint/validators/documentation/blank_line_before_definition.rb +63 -0
- data/lib/yard/lint/validators/documentation/empty_comment_line/config.rb +24 -0
- data/lib/yard/lint/validators/documentation/empty_comment_line/messages_builder.rb +34 -0
- data/lib/yard/lint/validators/documentation/empty_comment_line/parser.rb +60 -0
- data/lib/yard/lint/validators/documentation/empty_comment_line/result.rb +25 -0
- data/lib/yard/lint/validators/documentation/empty_comment_line/validator.rb +109 -0
- data/lib/yard/lint/validators/documentation/empty_comment_line.rb +58 -0
- data/lib/yard/lint/validators/documentation/markdown_syntax/validator.rb +36 -21
- data/lib/yard/lint/validators/documentation/markdown_syntax.rb +0 -1
- data/lib/yard/lint/validators/documentation/undocumented_boolean_methods/validator.rb +19 -29
- data/lib/yard/lint/validators/documentation/undocumented_boolean_methods.rb +0 -1
- data/lib/yard/lint/validators/documentation/undocumented_method_arguments/validator.rb +18 -34
- data/lib/yard/lint/validators/documentation/undocumented_method_arguments.rb +0 -1
- data/lib/yard/lint/validators/documentation/undocumented_objects/parser.rb +2 -2
- data/lib/yard/lint/validators/documentation/undocumented_objects/validator.rb +17 -25
- data/lib/yard/lint/validators/documentation/undocumented_objects.rb +4 -5
- data/lib/yard/lint/validators/documentation/undocumented_options/validator.rb +30 -21
- data/lib/yard/lint/validators/documentation/undocumented_options.rb +0 -1
- data/lib/yard/lint/validators/semantic/abstract_methods/result.rb +2 -2
- data/lib/yard/lint/validators/semantic/abstract_methods/validator.rb +31 -43
- data/lib/yard/lint/validators/semantic/abstract_methods.rb +0 -1
- data/lib/yard/lint/validators/tags/api_tags/validator.rb +24 -39
- data/lib/yard/lint/validators/tags/api_tags.rb +0 -1
- data/lib/yard/lint/validators/tags/collection_type/parser.rb +1 -1
- data/lib/yard/lint/validators/tags/collection_type/validator.rb +37 -66
- data/lib/yard/lint/validators/tags/collection_type.rb +0 -1
- data/lib/yard/lint/validators/tags/example_syntax/validator.rb +51 -64
- data/lib/yard/lint/validators/tags/example_syntax.rb +0 -1
- data/lib/yard/lint/validators/tags/informal_notation/config.rb +40 -0
- data/lib/yard/lint/validators/tags/informal_notation/messages_builder.rb +35 -0
- data/lib/yard/lint/validators/tags/informal_notation/parser.rb +55 -0
- data/lib/yard/lint/validators/tags/informal_notation/result.rb +26 -0
- data/lib/yard/lint/validators/tags/informal_notation/validator.rb +133 -0
- data/lib/yard/lint/validators/tags/informal_notation.rb +45 -0
- data/lib/yard/lint/validators/tags/invalid_types/validator.rb +57 -70
- data/lib/yard/lint/validators/tags/invalid_types.rb +0 -1
- data/lib/yard/lint/validators/tags/meaningless_tag/parser.rb +1 -1
- data/lib/yard/lint/validators/tags/meaningless_tag/validator.rb +22 -54
- data/lib/yard/lint/validators/tags/meaningless_tag.rb +0 -1
- data/lib/yard/lint/validators/tags/non_ascii_type/config.rb +21 -0
- data/lib/yard/lint/validators/tags/non_ascii_type/messages_builder.rb +29 -0
- data/lib/yard/lint/validators/tags/non_ascii_type/parser.rb +59 -0
- data/lib/yard/lint/validators/tags/non_ascii_type/result.rb +25 -0
- data/lib/yard/lint/validators/tags/non_ascii_type/validator.rb +50 -0
- data/lib/yard/lint/validators/tags/non_ascii_type.rb +39 -0
- data/lib/yard/lint/validators/tags/option_tags/result.rb +2 -2
- data/lib/yard/lint/validators/tags/option_tags/validator.rb +25 -40
- data/lib/yard/lint/validators/tags/option_tags.rb +0 -1
- data/lib/yard/lint/validators/tags/order/validator.rb +28 -55
- data/lib/yard/lint/validators/tags/order.rb +0 -1
- data/lib/yard/lint/validators/tags/redundant_param_description/config.rb +15 -1
- data/lib/yard/lint/validators/tags/redundant_param_description/messages_builder.rb +5 -0
- data/lib/yard/lint/validators/tags/redundant_param_description/validator.rb +134 -100
- data/lib/yard/lint/validators/tags/redundant_param_description.rb +0 -1
- data/lib/yard/lint/validators/tags/tag_group_separator/config.rb +29 -0
- data/lib/yard/lint/validators/tags/tag_group_separator/messages_builder.rb +49 -0
- data/lib/yard/lint/validators/tags/tag_group_separator/parser.rb +67 -0
- data/lib/yard/lint/validators/tags/tag_group_separator/result.rb +28 -0
- data/lib/yard/lint/validators/tags/tag_group_separator/validator.rb +117 -0
- data/lib/yard/lint/validators/tags/tag_group_separator.rb +49 -0
- data/lib/yard/lint/validators/tags/tag_type_position/parser.rb +1 -1
- data/lib/yard/lint/validators/tags/tag_type_position/validator.rb +53 -84
- data/lib/yard/lint/validators/tags/tag_type_position.rb +4 -5
- data/lib/yard/lint/validators/tags/type_syntax/parser.rb +8 -3
- data/lib/yard/lint/validators/tags/type_syntax/validator.rb +29 -59
- data/lib/yard/lint/validators/tags/type_syntax.rb +0 -1
- data/lib/yard/lint/validators/warnings/duplicated_parameter_name/validator.rb +1 -18
- data/lib/yard/lint/validators/warnings/invalid_directive_format/validator.rb +1 -18
- data/lib/yard/lint/validators/warnings/invalid_tag_format/validator.rb +1 -18
- data/lib/yard/lint/validators/warnings/unknown_directive/validator.rb +1 -18
- data/lib/yard/lint/validators/warnings/unknown_parameter_name/messages_builder.rb +243 -0
- data/lib/yard/lint/validators/warnings/unknown_parameter_name/result.rb +4 -3
- data/lib/yard/lint/validators/warnings/unknown_parameter_name/validator.rb +1 -18
- data/lib/yard/lint/validators/warnings/unknown_tag/messages_builder.rb +144 -0
- data/lib/yard/lint/validators/warnings/unknown_tag/result.rb +4 -3
- data/lib/yard/lint/validators/warnings/unknown_tag/validator.rb +1 -18
- data/lib/yard/lint/validators/warnings/unknown_tag.rb +10 -0
- data/lib/yard/lint/version.rb +1 -1
- data/lib/yard/lint.rb +81 -13
- data/renovate.json +1 -8
- metadata +40 -6
- data/bin/console +0 -11
- data/bin/setup +0 -8
- data/lib/yard/lint/command_cache.rb +0 -93
|
@@ -9,100 +9,69 @@ module Yard
|
|
|
9
9
|
# YARD standard (type_after_name): @param name [String] description
|
|
10
10
|
# Alternative (type_first): @param name [String] description
|
|
11
11
|
#
|
|
12
|
-
#
|
|
12
|
+
# @note @return tags are not checked as they don't have parameter names
|
|
13
13
|
class Validator < Base
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# @
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
'
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# Skip comment-only lines without tags
|
|
65
|
-
next unless line.include?("@")
|
|
66
|
-
|
|
67
|
-
checked_tags.each do |tag_name|
|
|
68
|
-
if enforced_style == "type_first"
|
|
69
|
-
# Detect: @tag_name word [Type] (violation when type_first is enforced)
|
|
70
|
-
pattern = /@\#{tag_name}\\s+(\\w+)\\s+\\[([^\\]]+)\\]/
|
|
71
|
-
if line =~ pattern
|
|
72
|
-
param_name = $1
|
|
73
|
-
type_info = $2
|
|
74
|
-
puts object.file + ":" + (line_num + 1).to_s + ": " + object.title
|
|
75
|
-
puts tag_name + "|" + param_name + "|" + type_info + "|type_after_name"
|
|
76
|
-
end
|
|
77
|
-
else
|
|
78
|
-
# Detect: @tag_name [Type] word (violation when type_after_name is enforced)
|
|
79
|
-
pattern = /@\#{tag_name}\\s+\\[([^\\]]+)\\]\\s+(\\w+)/
|
|
80
|
-
if line =~ pattern
|
|
81
|
-
type_info = $1
|
|
82
|
-
param_name = $2
|
|
83
|
-
puts object.file + ":" + (line_num + 1).to_s + ": " + object.title
|
|
84
|
-
puts tag_name + "|" + param_name + "|" + type_info + "|type_first"
|
|
85
|
-
end
|
|
14
|
+
# Enable in-process execution
|
|
15
|
+
in_process visibility: :public
|
|
16
|
+
|
|
17
|
+
# Execute query for a single object during in-process execution.
|
|
18
|
+
# Checks type annotation position in @param and @option tags.
|
|
19
|
+
# @param object [YARD::CodeObjects::Base] the code object to query
|
|
20
|
+
# @param collector [Executor::ResultCollector] collector for output
|
|
21
|
+
# @return [void]
|
|
22
|
+
def in_process_query(object, collector)
|
|
23
|
+
return unless object.file && File.exist?(object.file)
|
|
24
|
+
|
|
25
|
+
checked_tags = config_or_default('CheckedTags')
|
|
26
|
+
style = enforced_style
|
|
27
|
+
|
|
28
|
+
source_lines = File.readlines(object.file)
|
|
29
|
+
start_line = [object.line - 50, 0].max
|
|
30
|
+
end_line = [object.line, source_lines.length - 1].min
|
|
31
|
+
|
|
32
|
+
# Look for comments before the object definition
|
|
33
|
+
(start_line...(end_line - 1)).reverse_each do |line_num|
|
|
34
|
+
line = source_lines[line_num].to_s.strip
|
|
35
|
+
|
|
36
|
+
# Skip empty lines
|
|
37
|
+
next if line.empty?
|
|
38
|
+
|
|
39
|
+
# Stop if we hit code (non-comment line)
|
|
40
|
+
break unless line.start_with?('#')
|
|
41
|
+
|
|
42
|
+
# Skip comment-only lines without tags
|
|
43
|
+
next unless line.include?('@')
|
|
44
|
+
|
|
45
|
+
checked_tags.each do |tag_name|
|
|
46
|
+
if style == 'type_first'
|
|
47
|
+
# Detect: @tag_name word [Type] (violation when type_first is enforced)
|
|
48
|
+
pattern = /@#{tag_name}\s+(\w+)\s+\[([^\]]+)\]/
|
|
49
|
+
if line =~ pattern
|
|
50
|
+
param_name = ::Regexp.last_match(1)
|
|
51
|
+
type_info = ::Regexp.last_match(2)
|
|
52
|
+
collector.puts "#{object.file}:#{line_num + 1}: #{object.title}"
|
|
53
|
+
collector.puts "#{tag_name}|#{param_name}|#{type_info}|type_after_name"
|
|
54
|
+
end
|
|
55
|
+
else
|
|
56
|
+
# Detect: @tag_name [Type] word (violation when type_after_name is enforced)
|
|
57
|
+
pattern = /@#{tag_name}\s+\[([^\]]+)\]\s+(\w+)/
|
|
58
|
+
if line =~ pattern
|
|
59
|
+
type_info = ::Regexp.last_match(1)
|
|
60
|
+
param_name = ::Regexp.last_match(2)
|
|
61
|
+
collector.puts "#{object.file}:#{line_num + 1}: #{object.title}"
|
|
62
|
+
collector.puts "#{tag_name}|#{param_name}|#{type_info}|type_first"
|
|
86
63
|
end
|
|
87
64
|
end
|
|
88
65
|
end
|
|
89
|
-
|
|
90
|
-
false
|
|
91
|
-
'
|
|
92
|
-
QUERY
|
|
66
|
+
end
|
|
93
67
|
end
|
|
94
68
|
|
|
69
|
+
private
|
|
70
|
+
|
|
95
71
|
# @return [String] the enforced style ('type_after_name' (standard) or 'type_first')
|
|
96
72
|
def enforced_style
|
|
97
73
|
config_or_default('EnforcedStyle')
|
|
98
74
|
end
|
|
99
|
-
|
|
100
|
-
# Array of tag names to check, formatted for YARD query
|
|
101
|
-
# @return [String] Ruby array literal string
|
|
102
|
-
def checked_tags_array
|
|
103
|
-
tags = config_or_default('CheckedTags')
|
|
104
|
-
"[#{tags.map { |t| "\"#{t}\"" }.join(',')}]"
|
|
105
|
-
end
|
|
106
75
|
end
|
|
107
76
|
end
|
|
108
77
|
end
|
|
@@ -20,8 +20,8 @@ module Yard
|
|
|
20
20
|
# end
|
|
21
21
|
#
|
|
22
22
|
# @example Bad - Type before parameter name (when using default style)
|
|
23
|
-
# # @param [String]
|
|
24
|
-
# # @param [Integer]
|
|
23
|
+
# # @param name [String] the user's name
|
|
24
|
+
# # @param age [Integer] the user's age
|
|
25
25
|
# def create_user(name, age)
|
|
26
26
|
# end
|
|
27
27
|
#
|
|
@@ -33,8 +33,8 @@ module Yard
|
|
|
33
33
|
# EnforcedStyle: type_first
|
|
34
34
|
#
|
|
35
35
|
# @example Good - When EnforcedStyle is type_first
|
|
36
|
-
# # @param [String]
|
|
37
|
-
# # @param [Integer]
|
|
36
|
+
# # @param name [String] the user's name
|
|
37
|
+
# # @param age [Integer] the user's age
|
|
38
38
|
# def create_user(name, age)
|
|
39
39
|
# end
|
|
40
40
|
#
|
|
@@ -42,7 +42,6 @@ module Yard
|
|
|
42
42
|
#
|
|
43
43
|
# Tags/TagTypePosition:
|
|
44
44
|
# Enabled: false
|
|
45
|
-
#
|
|
46
45
|
module TagTypePosition
|
|
47
46
|
end
|
|
48
47
|
end
|
|
@@ -13,12 +13,17 @@ module Yard
|
|
|
13
13
|
# file.rb:LINE: ClassName#method_name
|
|
14
14
|
# tag_name|type_string|error_message
|
|
15
15
|
# @param yard_output [String] raw YARD query results
|
|
16
|
-
# @
|
|
16
|
+
# @option _kwargs [Object] :unused this parameter accepts no options (reserved for future use)
|
|
17
17
|
# @return [Array<Hash>] array with violation details
|
|
18
18
|
def call(yard_output, **_kwargs)
|
|
19
|
-
return [] if yard_output.nil?
|
|
19
|
+
return [] if yard_output.nil?
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
# Handle encoding issues from YARD output that may contain invalid UTF-8 sequences
|
|
22
|
+
# This can happen when YARD processes files with non-ASCII characters in type specs
|
|
23
|
+
sanitized = yard_output.encode('UTF-8', invalid: :replace, undef: :replace, replace: '')
|
|
24
|
+
return [] if sanitized.strip.empty?
|
|
25
|
+
|
|
26
|
+
lines = sanitized.split("\n").map(&:strip).reject(&:empty?)
|
|
22
27
|
violations = []
|
|
23
28
|
|
|
24
29
|
lines.each_slice(2) do |location_line, details_line|
|
|
@@ -7,66 +7,36 @@ module Yard
|
|
|
7
7
|
module TypeSyntax
|
|
8
8
|
# Runs YARD to validate type syntax using TypesExplainer::Parser
|
|
9
9
|
class Validator < Base
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# @
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<<~QUERY.strip
|
|
38
|
-
'
|
|
39
|
-
require "yard"
|
|
40
|
-
|
|
41
|
-
docstring
|
|
42
|
-
.tags
|
|
43
|
-
.select { |tag| #{validated_tags_array}.include?(tag.tag_name) }
|
|
44
|
-
.each do |tag|
|
|
45
|
-
next unless tag.types
|
|
46
|
-
|
|
47
|
-
tag.types.each do |type_str|
|
|
48
|
-
begin
|
|
49
|
-
YARD::Tags::TypesExplainer::Parser.parse(type_str)
|
|
50
|
-
rescue SyntaxError => e
|
|
51
|
-
puts object.file + ":" + object.line.to_s + ": " + object.title
|
|
52
|
-
puts tag.tag_name + "|" + type_str + "|" + e.message
|
|
53
|
-
break
|
|
54
|
-
end
|
|
55
|
-
end
|
|
10
|
+
# Enable in-process execution
|
|
11
|
+
in_process visibility: :public
|
|
12
|
+
|
|
13
|
+
# Execute query for a single object during in-process execution.
|
|
14
|
+
# Validates type syntax in tags using YARD's TypesExplainer::Parser.
|
|
15
|
+
# @param object [YARD::CodeObjects::Base] the code object to query
|
|
16
|
+
# @param collector [Executor::ResultCollector] collector for output
|
|
17
|
+
# @return [void]
|
|
18
|
+
def in_process_query(object, collector)
|
|
19
|
+
validated_tags = config.validator_config('Tags/TypeSyntax', 'ValidatedTags') ||
|
|
20
|
+
%w[param option return yieldreturn]
|
|
21
|
+
|
|
22
|
+
object.docstring.tags
|
|
23
|
+
.select { |tag| validated_tags.include?(tag.tag_name) }
|
|
24
|
+
.each do |tag|
|
|
25
|
+
next unless tag.types
|
|
26
|
+
|
|
27
|
+
tag.types.each do |type_str|
|
|
28
|
+
begin
|
|
29
|
+
YARD::Tags::TypesExplainer::Parser.parse(type_str)
|
|
30
|
+
rescue SyntaxError => e
|
|
31
|
+
# Sanitize error message to handle invalid UTF-8 sequences
|
|
32
|
+
# YARD's parser may generate malformed error messages for non-ASCII input
|
|
33
|
+
error_msg = e.message.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
|
34
|
+
collector.puts "#{object.file}:#{object.line}: #{object.title}"
|
|
35
|
+
collector.puts "#{tag.tag_name}|#{type_str}|#{error_msg}"
|
|
36
|
+
break
|
|
56
37
|
end
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'
|
|
60
|
-
QUERY
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
# Array of tag names to validate, formatted for YARD query
|
|
64
|
-
# @return [String] Ruby array literal string
|
|
65
|
-
def validated_tags_array
|
|
66
|
-
tags = config.validator_config('Tags/TypeSyntax', 'ValidatedTags') || %w[
|
|
67
|
-
param option return yieldreturn
|
|
68
|
-
]
|
|
69
|
-
"[#{tags.map { |t| "\"#{t}\"" }.join(',')}]"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
70
40
|
end
|
|
71
41
|
end
|
|
72
42
|
end
|
|
@@ -5,25 +5,8 @@ module Yard
|
|
|
5
5
|
module Validators
|
|
6
6
|
module Warnings
|
|
7
7
|
module DuplicatedParameterName
|
|
8
|
-
#
|
|
8
|
+
# Validator for detecting duplicated parameter name warnings from YARD
|
|
9
9
|
class Validator < Base
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
# Runs YARD stats command with proper settings on a given dir and files
|
|
13
|
-
# @param dir [String] dir where we should generate the temp docs
|
|
14
|
-
# @param file_list_path [String] path to temp file containing file paths (one per line)
|
|
15
|
-
# @return [Hash] shell command execution hash results
|
|
16
|
-
def yard_cmd(dir, file_list_path)
|
|
17
|
-
cmd = <<~CMD
|
|
18
|
-
cat #{Shellwords.escape(file_list_path)} | xargs yard stats \
|
|
19
|
-
#{shell_arguments} \
|
|
20
|
-
--compact \
|
|
21
|
-
-b #{Shellwords.escape(dir)}
|
|
22
|
-
CMD
|
|
23
|
-
cmd = cmd.tr("\n", ' ')
|
|
24
|
-
|
|
25
|
-
shell(cmd)
|
|
26
|
-
end
|
|
27
10
|
end
|
|
28
11
|
end
|
|
29
12
|
end
|
|
@@ -5,25 +5,8 @@ module Yard
|
|
|
5
5
|
module Validators
|
|
6
6
|
module Warnings
|
|
7
7
|
module InvalidDirectiveFormat
|
|
8
|
-
#
|
|
8
|
+
# Validator for detecting invalid directive format warnings from YARD
|
|
9
9
|
class Validator < Base
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
# Runs YARD stats command with proper settings on a given dir and files
|
|
13
|
-
# @param dir [String] dir where we should generate the temp docs
|
|
14
|
-
# @param file_list_path [String] path to temp file containing file paths (one per line)
|
|
15
|
-
# @return [Hash] shell command execution hash results
|
|
16
|
-
def yard_cmd(dir, file_list_path)
|
|
17
|
-
cmd = <<~CMD
|
|
18
|
-
cat #{Shellwords.escape(file_list_path)} | xargs yard stats \
|
|
19
|
-
#{shell_arguments} \
|
|
20
|
-
--compact \
|
|
21
|
-
-b #{Shellwords.escape(dir)}
|
|
22
|
-
CMD
|
|
23
|
-
cmd = cmd.tr("\n", ' ')
|
|
24
|
-
|
|
25
|
-
shell(cmd)
|
|
26
|
-
end
|
|
27
10
|
end
|
|
28
11
|
end
|
|
29
12
|
end
|
|
@@ -5,25 +5,8 @@ module Yard
|
|
|
5
5
|
module Validators
|
|
6
6
|
module Warnings
|
|
7
7
|
module InvalidTagFormat
|
|
8
|
-
#
|
|
8
|
+
# Validator for detecting invalid tag format warnings from YARD
|
|
9
9
|
class Validator < Base
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
# Runs YARD stats command with proper settings on a given dir and files
|
|
13
|
-
# @param dir [String] dir where we should generate the temp docs
|
|
14
|
-
# @param file_list_path [String] path to temp file containing file paths (one per line)
|
|
15
|
-
# @return [Hash] shell command execution hash results
|
|
16
|
-
def yard_cmd(dir, file_list_path)
|
|
17
|
-
cmd = <<~CMD
|
|
18
|
-
cat #{Shellwords.escape(file_list_path)} | xargs yard stats \
|
|
19
|
-
#{shell_arguments} \
|
|
20
|
-
--compact \
|
|
21
|
-
-b #{Shellwords.escape(dir)}
|
|
22
|
-
CMD
|
|
23
|
-
cmd = cmd.tr("\n", ' ')
|
|
24
|
-
|
|
25
|
-
shell(cmd)
|
|
26
|
-
end
|
|
27
10
|
end
|
|
28
11
|
end
|
|
29
12
|
end
|
|
@@ -5,25 +5,8 @@ module Yard
|
|
|
5
5
|
module Validators
|
|
6
6
|
module Warnings
|
|
7
7
|
module UnknownDirective
|
|
8
|
-
#
|
|
8
|
+
# Validator for detecting unknown directive warnings from YARD
|
|
9
9
|
class Validator < Base
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
# Runs YARD stats command with proper settings on a given dir and files
|
|
13
|
-
# @param dir [String] dir where we should generate the temp docs
|
|
14
|
-
# @param file_list_path [String] path to temp file containing file paths (one per line)
|
|
15
|
-
# @return [Hash] shell command execution hash results
|
|
16
|
-
def yard_cmd(dir, file_list_path)
|
|
17
|
-
cmd = <<~CMD
|
|
18
|
-
cat #{Shellwords.escape(file_list_path)} | xargs yard stats \
|
|
19
|
-
#{shell_arguments} \
|
|
20
|
-
--compact \
|
|
21
|
-
-b #{Shellwords.escape(dir)}
|
|
22
|
-
CMD
|
|
23
|
-
cmd = cmd.tr("\n", ' ')
|
|
24
|
-
|
|
25
|
-
shell(cmd)
|
|
26
|
-
end
|
|
27
10
|
end
|
|
28
11
|
end
|
|
29
12
|
end
|