Skip to content

Conversation

@marcotc
Copy link

@marcotc marcotc commented Nov 25, 2021

Description

This PR prevents YARD from adding a period (.) to the end of sentences that already end in a terminal punctuation character: ., ?, or !.

This is specially helpful for methods in Ruby that end with a ?, as they normally convey an interrogation:

# Has this object been successfully configured for use?
def ready?
  # ...
end

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

if !@summary.empty? && @summary !~ /\A\s*\{include:.+\}\s*\Z/
if !@summary.empty? &&
@summary !~ /\A\s*\{include:.+\}\s*\Z/ && # Summary is copied using +{include:...}+
@summary !~ /[!?]\s*\Z/ # Summary ends in a terminal punctuation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you probably want to include other punctuation marks here (: ; etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants