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

Don't generate the same character twice in a row #85

Merged
merged 1 commit into from
Dec 29, 2024

Conversation

eltoder
Copy link
Contributor

@eltoder eltoder commented Nov 29, 2024

Fixes #82

Type of change:

  • Refactor
  • Performance improvement
  • New feature
  • Bug fix
  • Other (please describe):

Please describe the changes this PR makes and why it should be merged:

Don't generate the same character twice in a row in randomCharFromSetCensorStrategy(). This produces more interesting strings and avoids generating "@$$" as a side-effect.

Status:

  • I've added/modified unit tests relevant to my change / not needed
  • This PR contains breaking changes
  • This PR doesn't include changes to the code

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (36b6512) to head (668d46e).
Report is 38 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #85   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        26    -1     
  Lines          505       473   -32     
  Branches        92        88    -4     
=========================================
- Hits           505       473   -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eltoder eltoder force-pushed the feature/grawlix-avoid-repeats branch from 37a04a6 to 6e57c9c Compare December 3, 2024 01:14
Copy link
Owner

@jo3-l jo3-l left a comment

Choose a reason for hiding this comment

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

Thanks, this is nice! One minor nit, if you don't mind:

src/censor/BuiltinStrategies.ts Outdated Show resolved Hide resolved
In randomCharFromSetCensorStrategy(). This produces more interesting
strings and avoids generating "@$$" as a side-effect.

Fixes jo3-l#82
@eltoder eltoder force-pushed the feature/grawlix-avoid-repeats branch from 6e57c9c to 668d46e Compare December 28, 2024 21:57
@eltoder
Copy link
Contributor Author

eltoder commented Dec 28, 2024

@jo3-l Updated. Please take another look.

Copy link
Owner

@jo3-l jo3-l left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jo3-l jo3-l merged commit 58f2715 into jo3-l:main Dec 29, 2024
9 checks passed
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.

bug: grawlixCensorStrategy sometimes generates "@$$"
2 participants