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.
@@ -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