Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate terminal punctuation in summary #1412

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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