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

tools.compile_rule: better whitespace handling for $nick placeholder #1920

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

dgw
Copy link
Member

@dgw dgw commented Aug 7, 2020

Description

If the placeholder is followed by a space, replace it with a pattern that will consume extra whitespace but doesn't require any.

If the placeholder is NOT followed by a space, use the original pattern that requires at least one space to match.

Meant to resolve #1885.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make quality and make test)
  • I have tested the functionality of the things this change touches

@dgw dgw added the Tweak label Aug 7, 2020
@dgw dgw added this to the 7.1.0 milestone Aug 7, 2020
@dgw dgw requested a review from a team August 7, 2020 22:19
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

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

OK, that was simple. Didn't expect that to be like that, but I'll take it.

Minor change requested as it explains why there is such a weird if.

sopel/tools/__init__.py Outdated Show resolved Hide resolved
If the placeholder is followed by a space, replace it with a pattern
that will consume extra whitespace but doesn't require any.

If the placeholder is NOT followed by a space, use the original pattern
that requires at least one space to match.
@dgw dgw force-pushed the rule-nick-placeholder branch from 66c306a to 5807799 Compare August 7, 2020 22:30
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

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

🐑 it

@dgw dgw merged commit c7f30fa into master Aug 27, 2020
@dgw dgw deleted the rule-nick-placeholder branch August 27, 2020 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rule: $nick in regex pattern is confusing
2 participants