Class: RuboCop::Cop::Sorbet::EnforceSignatures::RBSSignatureChecker
- Inherits:
-
SignatureChecker
- Object
- SignatureChecker
- RuboCop::Cop::Sorbet::EnforceSignatures::RBSSignatureChecker
- Defined in:
- lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb
Constant Summary collapse
- RBS_COMMENT_REGEX =
/^#\s*:.*$/
Instance Method Summary collapse
Methods inherited from SignatureChecker
Constructor Details
This class inherits a constructor from RuboCop::Cop::Sorbet::EnforceSignatures::SignatureChecker
Instance Method Details
#signature_node(node) ⇒ Object
223 224 225 226 227 228 229 230 231 232 |
# File 'lib/rubocop/cop/sorbet/signatures/enforce_signatures.rb', line 223 def signature_node(node) node = find_non_send_ancestor(node) comments = preceding_comments(node) return if comments.empty? last_comment = comments.last return if last_comment.loc.line + 1 < node.loc.line comments.find { |comment| RBS_COMMENT_REGEX.match?(comment.text) } end |