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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +174 -1
  3. data/README.md +118 -3
  4. data/Rakefile +20 -0
  5. data/bin/yard-lint +80 -37
  6. data/lib/yard/lint/config.rb +5 -0
  7. data/lib/yard/lint/config_generator.rb +8 -179
  8. data/lib/yard/lint/config_updater.rb +222 -0
  9. data/lib/yard/lint/errors.rb +6 -0
  10. data/lib/yard/lint/executor/in_process_registry.rb +130 -0
  11. data/lib/yard/lint/executor/query_executor.rb +109 -0
  12. data/lib/yard/lint/executor/result_collector.rb +55 -0
  13. data/lib/yard/lint/executor/warning_dispatcher.rb +79 -0
  14. data/lib/yard/lint/results/base.rb +2 -1
  15. data/lib/yard/lint/runner.rb +88 -35
  16. data/lib/yard/lint/stats_calculator.rb +1 -1
  17. data/lib/yard/lint/templates/default_config.yml +279 -0
  18. data/lib/yard/lint/templates/strict_config.yml +283 -0
  19. data/lib/yard/lint/validators/base.rb +52 -118
  20. data/lib/yard/lint/validators/documentation/blank_line_before_definition/config.rb +25 -0
  21. data/lib/yard/lint/validators/documentation/blank_line_before_definition/messages_builder.rb +39 -0
  22. data/lib/yard/lint/validators/documentation/blank_line_before_definition/parser.rb +59 -0
  23. data/lib/yard/lint/validators/documentation/blank_line_before_definition/result.rb +61 -0
  24. data/lib/yard/lint/validators/documentation/blank_line_before_definition/validator.rb +94 -0
  25. data/lib/yard/lint/validators/documentation/blank_line_before_definition.rb +63 -0
  26. data/lib/yard/lint/validators/documentation/empty_comment_line/config.rb +24 -0
  27. data/lib/yard/lint/validators/documentation/empty_comment_line/messages_builder.rb +34 -0
  28. data/lib/yard/lint/validators/documentation/empty_comment_line/parser.rb +60 -0
  29. data/lib/yard/lint/validators/documentation/empty_comment_line/result.rb +25 -0
  30. data/lib/yard/lint/validators/documentation/empty_comment_line/validator.rb +109 -0
  31. data/lib/yard/lint/validators/documentation/empty_comment_line.rb +58 -0
  32. data/lib/yard/lint/validators/documentation/markdown_syntax/validator.rb +36 -21
  33. data/lib/yard/lint/validators/documentation/markdown_syntax.rb +0 -1
  34. data/lib/yard/lint/validators/documentation/undocumented_boolean_methods/validator.rb +19 -29
  35. data/lib/yard/lint/validators/documentation/undocumented_boolean_methods.rb +0 -1
  36. data/lib/yard/lint/validators/documentation/undocumented_method_arguments/validator.rb +18 -34
  37. data/lib/yard/lint/validators/documentation/undocumented_method_arguments.rb +0 -1
  38. data/lib/yard/lint/validators/documentation/undocumented_objects/parser.rb +2 -2
  39. data/lib/yard/lint/validators/documentation/undocumented_objects/validator.rb +17 -25
  40. data/lib/yard/lint/validators/documentation/undocumented_objects.rb +4 -5
  41. data/lib/yard/lint/validators/documentation/undocumented_options/validator.rb +30 -21
  42. data/lib/yard/lint/validators/documentation/undocumented_options.rb +0 -1
  43. data/lib/yard/lint/validators/semantic/abstract_methods/result.rb +2 -2
  44. data/lib/yard/lint/validators/semantic/abstract_methods/validator.rb +31 -43
  45. data/lib/yard/lint/validators/semantic/abstract_methods.rb +0 -1
  46. data/lib/yard/lint/validators/tags/api_tags/validator.rb +24 -39
  47. data/lib/yard/lint/validators/tags/api_tags.rb +0 -1
  48. data/lib/yard/lint/validators/tags/collection_type/parser.rb +1 -1
  49. data/lib/yard/lint/validators/tags/collection_type/validator.rb +37 -66
  50. data/lib/yard/lint/validators/tags/collection_type.rb +0 -1
  51. data/lib/yard/lint/validators/tags/example_syntax/validator.rb +51 -64
  52. data/lib/yard/lint/validators/tags/example_syntax.rb +0 -1
  53. data/lib/yard/lint/validators/tags/informal_notation/config.rb +40 -0
  54. data/lib/yard/lint/validators/tags/informal_notation/messages_builder.rb +35 -0
  55. data/lib/yard/lint/validators/tags/informal_notation/parser.rb +55 -0
  56. data/lib/yard/lint/validators/tags/informal_notation/result.rb +26 -0
  57. data/lib/yard/lint/validators/tags/informal_notation/validator.rb +133 -0
  58. data/lib/yard/lint/validators/tags/informal_notation.rb +45 -0
  59. data/lib/yard/lint/validators/tags/invalid_types/validator.rb +57 -70
  60. data/lib/yard/lint/validators/tags/invalid_types.rb +0 -1
  61. data/lib/yard/lint/validators/tags/meaningless_tag/parser.rb +1 -1
  62. data/lib/yard/lint/validators/tags/meaningless_tag/validator.rb +22 -54
  63. data/lib/yard/lint/validators/tags/meaningless_tag.rb +0 -1
  64. data/lib/yard/lint/validators/tags/non_ascii_type/config.rb +21 -0
  65. data/lib/yard/lint/validators/tags/non_ascii_type/messages_builder.rb +29 -0
  66. data/lib/yard/lint/validators/tags/non_ascii_type/parser.rb +59 -0
  67. data/lib/yard/lint/validators/tags/non_ascii_type/result.rb +25 -0
  68. data/lib/yard/lint/validators/tags/non_ascii_type/validator.rb +50 -0
  69. data/lib/yard/lint/validators/tags/non_ascii_type.rb +39 -0
  70. data/lib/yard/lint/validators/tags/option_tags/result.rb +2 -2
  71. data/lib/yard/lint/validators/tags/option_tags/validator.rb +25 -40
  72. data/lib/yard/lint/validators/tags/option_tags.rb +0 -1
  73. data/lib/yard/lint/validators/tags/order/validator.rb +28 -55
  74. data/lib/yard/lint/validators/tags/order.rb +0 -1
  75. data/lib/yard/lint/validators/tags/redundant_param_description/config.rb +15 -1
  76. data/lib/yard/lint/validators/tags/redundant_param_description/messages_builder.rb +5 -0
  77. data/lib/yard/lint/validators/tags/redundant_param_description/validator.rb +134 -100
  78. data/lib/yard/lint/validators/tags/redundant_param_description.rb +0 -1
  79. data/lib/yard/lint/validators/tags/tag_group_separator/config.rb +29 -0
  80. data/lib/yard/lint/validators/tags/tag_group_separator/messages_builder.rb +49 -0
  81. data/lib/yard/lint/validators/tags/tag_group_separator/parser.rb +67 -0
  82. data/lib/yard/lint/validators/tags/tag_group_separator/result.rb +28 -0
  83. data/lib/yard/lint/validators/tags/tag_group_separator/validator.rb +117 -0
  84. data/lib/yard/lint/validators/tags/tag_group_separator.rb +49 -0
  85. data/lib/yard/lint/validators/tags/tag_type_position/parser.rb +1 -1
  86. data/lib/yard/lint/validators/tags/tag_type_position/validator.rb +53 -84
  87. data/lib/yard/lint/validators/tags/tag_type_position.rb +4 -5
  88. data/lib/yard/lint/validators/tags/type_syntax/parser.rb +8 -3
  89. data/lib/yard/lint/validators/tags/type_syntax/validator.rb +29 -59
  90. data/lib/yard/lint/validators/tags/type_syntax.rb +0 -1
  91. data/lib/yard/lint/validators/warnings/duplicated_parameter_name/validator.rb +1 -18
  92. data/lib/yard/lint/validators/warnings/invalid_directive_format/validator.rb +1 -18
  93. data/lib/yard/lint/validators/warnings/invalid_tag_format/validator.rb +1 -18
  94. data/lib/yard/lint/validators/warnings/unknown_directive/validator.rb +1 -18
  95. data/lib/yard/lint/validators/warnings/unknown_parameter_name/messages_builder.rb +243 -0
  96. data/lib/yard/lint/validators/warnings/unknown_parameter_name/result.rb +4 -3
  97. data/lib/yard/lint/validators/warnings/unknown_parameter_name/validator.rb +1 -18
  98. data/lib/yard/lint/validators/warnings/unknown_tag/messages_builder.rb +144 -0
  99. data/lib/yard/lint/validators/warnings/unknown_tag/result.rb +4 -3
  100. data/lib/yard/lint/validators/warnings/unknown_tag/validator.rb +1 -18
  101. data/lib/yard/lint/validators/warnings/unknown_tag.rb +10 -0
  102. data/lib/yard/lint/version.rb +1 -1
  103. data/lib/yard/lint.rb +81 -13
  104. data/renovate.json +1 -8
  105. metadata +40 -6
  106. data/bin/console +0 -11
  107. data/bin/setup +0 -8
  108. 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
- # Note: @return tags are not checked as they don't have parameter names
12
+ # @note @return tags are not checked as they don't have parameter names
13
13
  class Validator < Base
14
- private
15
-
16
- # Runs YARD query to check type position in tags
17
- # @param dir [String] directory where YARD database is stored
18
- # @param file_list_path [String] path to temp file containing file paths (one per line)
19
- # @return [Hash] shell command execution results
20
- def yard_cmd(dir, file_list_path)
21
- # Write query to a temporary file to avoid shell escaping issues
22
- cmd = "cat #{Shellwords.escape(file_list_path)} | xargs yard list --query #{query} "
23
-
24
- Tempfile.create(['yard_query', '.sh']) do |f|
25
- f.write("#!/bin/bash\n")
26
- f.write(cmd)
27
- f.write("#{shell_arguments} -b #{Shellwords.escape(dir)}\n")
28
- f.flush
29
- f.chmod(0o755)
30
-
31
- shell("bash #{Shellwords.escape(f.path)}")
32
- end
33
- end
34
-
35
- # YARD query that checks source code directly instead of docstring.all
36
- # Detects patterns based on configured style
37
- # @return [String] YARD query string
38
- def query
39
- <<~QUERY.strip
40
- '
41
- require "ripper"
42
-
43
- checked_tags = #{checked_tags_array}
44
- enforced_style = "#{enforced_style}"
45
-
46
- # Read the source file and find comment lines for this object
47
- return false unless object.file && File.exist?(object.file)
48
-
49
- source_lines = File.readlines(object.file)
50
- start_line = [object.line - 50, 0].max
51
- end_line = [object.line, source_lines.length - 1].min
52
-
53
- # Look for comments before the object definition
54
- # Start just before the object line and scan backward
55
- (start_line...(end_line - 1)).reverse_each do |line_num|
56
- line = source_lines[line_num].to_s.strip
57
-
58
- # Skip empty lines
59
- next if line.empty?
60
-
61
- # Stop if we hit code (non-comment line)
62
- break unless line.start_with?("#")
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] name the user's name
24
- # # @param [Integer] age the user's age
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] name the user's name
37
- # # @param [Integer] age the user's age
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
- # @param _kwargs [Hash] unused keyword arguments (for compatibility)
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? || yard_output.strip.empty?
19
+ return [] if yard_output.nil?
20
20
 
21
- lines = yard_output.split("\n").map(&:strip).reject(&:empty?)
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
- private
11
-
12
- # Runs YARD query to validate type syntax on given files
13
- # @param dir [String] directory where YARD database is stored
14
- # @param file_list_path [String] path to temp file containing file paths (one per line)
15
- # @return [Hash] shell command execution results
16
- def yard_cmd(dir, file_list_path)
17
- # Write query to a temporary file to avoid shell escaping issues
18
- cmd = "cat #{Shellwords.escape(file_list_path)} | xargs yard list --query #{query} "
19
-
20
- Tempfile.create(['yard_query', '.sh']) do |f|
21
- f.write("#!/bin/bash\n")
22
- f.write(cmd)
23
- f.write("#{shell_arguments} -b #{Shellwords.escape(dir)}\n")
24
- f.flush
25
- f.chmod(0o755)
26
-
27
- shell("bash #{Shellwords.escape(f.path)}")
28
- end
29
- end
30
-
31
- # YARD query that validates type syntax for each tag
32
- # Format output as two lines per violation:
33
- # Line 1: file.rb:LINE: ClassName#method_name
34
- # Line 2: tag_name|type_string|error_message
35
- # @return [String] YARD query string
36
- def query
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
- false
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
@@ -29,7 +29,6 @@ module Yard
29
29
  #
30
30
  # Tags/TypeSyntax:
31
31
  # Enabled: false
32
- #
33
32
  module TypeSyntax
34
33
  end
35
34
  end
@@ -5,25 +5,8 @@ module Yard
5
5
  module Validators
6
6
  module Warnings
7
7
  module DuplicatedParameterName
8
- # Runs YARD stats command to check for duplicatedparametername
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
- # Runs YARD stats command to check for invaliddirectiveformat
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
- # Runs YARD stats command to check for invalidtagformat
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
- # Runs YARD stats command to check for unknowndirective
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