rubocop-yardoc 0.2.0 → 0.2.2
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 +13 -0
- data/README.md +1 -7
- data/cops.adoc +823 -0
- data/lib/rubocop/cop/mixin/param_help.rb +8 -7
- data/lib/rubocop/cop/yardoc/class_description.rb +19 -10
- data/lib/rubocop/cop/yardoc/column_params.rb +5 -1
- data/lib/rubocop/cop/yardoc/constant_description.rb +16 -5
- data/lib/rubocop/cop/yardoc/method_description.rb +37 -11
- data/lib/rubocop/cop/yardoc/module_description.rb +20 -12
- data/lib/rubocop/cop/yardoc/param_description_casing.rb +3 -1
- data/lib/rubocop/cop/yardoc/param_documentation.rb +6 -3
- data/lib/rubocop/cop/yardoc/separate_tags_blocks.rb +3 -1
- data/lib/rubocop/cop/yardoc/supported_tags.rb +9 -6
- data/lib/rubocop/cop/yardoc/tag_order.rb +6 -2
- data/lib/rubocop/cop/yardoc/types_format.rb +4 -2
- data/lib/rubocop/cop/yardoc/valid_types.rb +4 -4
- data/lib/rubocop/cop/yardoc/yield_documentation.rb +8 -4
- data/lib/rubocop/cop/yardoc_base.rb +62 -0
- data/lib/rubocop/cop/yardoc_cops.rb +1 -1
- data/lib/rubocop/yardoc/version.rb +1 -1
- metadata +4 -3
- data/lib/rubocop/cop/yardoc/base.rb +0 -64
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RuboCop
|
|
4
|
-
module Cop
|
|
5
|
-
module Yardoc
|
|
6
|
-
# Base class that provides shared YARD parsing utilities for all YARD cops.
|
|
7
|
-
class Base < RuboCop::Cop::Base
|
|
8
|
-
# Represents a comment entry (it may be a multi-line comment)
|
|
9
|
-
#
|
|
10
|
-
# @return [Struct] With :comment, :text, :tag, :line, :blank?
|
|
11
|
-
CommentEntry = Struct.new(:comment, :text, :tag, :line, :blank, keyword_init: true) do
|
|
12
|
-
# Whether the comment is empty
|
|
13
|
-
#
|
|
14
|
-
# @return [Boolean]
|
|
15
|
-
def blank?
|
|
16
|
-
blank
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
# Checks whether a node has any preceding documentation comments.
|
|
23
|
-
#
|
|
24
|
-
# @param node [RuboCop::AST::Node] The AST node
|
|
25
|
-
#
|
|
26
|
-
# @return [Boolean]
|
|
27
|
-
def documented?(node)
|
|
28
|
-
node_comments(node).any?
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Checks whether a name matches any entry in an ignore list from cop configuration.
|
|
32
|
-
# Entries may be plain strings or /regexp/ strings.
|
|
33
|
-
#
|
|
34
|
-
# @param name [String] The fully-qualified name to check
|
|
35
|
-
# @param list [Array<String>] List of names or /pattern/ strings
|
|
36
|
-
#
|
|
37
|
-
# @return [Boolean]
|
|
38
|
-
def ignored?(name, list)
|
|
39
|
-
list.any? do |pattern|
|
|
40
|
-
if pattern.start_with?('/') && pattern.end_with?('/')
|
|
41
|
-
Regexp.new(pattern[1..-2]).match?(name)
|
|
42
|
-
else
|
|
43
|
-
name == pattern
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# List of symbols ignored for the cop
|
|
49
|
-
def ignore_list
|
|
50
|
-
Array(cop_config['Ignore'])
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Parsed node comments
|
|
54
|
-
#
|
|
55
|
-
# @param node [RuboCop::AST::Node] The AST node
|
|
56
|
-
#
|
|
57
|
-
# @return [Array<Parser::Source::Comment>]
|
|
58
|
-
def node_comments(node)
|
|
59
|
-
processed_source.ast_with_comments.fetch(node, [])
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|