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

Allow ranges for excluded_sequences config option #4051

Merged
merged 7 commits into from
Jun 21, 2024

Conversation

ljoss17
Copy link
Contributor

@ljoss17 ljoss17 commented Jun 20, 2024

Closes: #4047

Description

This PR changes the type of excluded_sequences in the configuration to be a ExcludedSequences which has custom serialisation and deserialisation. This allows the usage of ranges of sequences in addition to exact values.
It is now possible to specify excluded sequences using:

  • Exact values, e.g. [1, 2, 3]
  • Range with "..=", e.g. ["1..=3"]
  • Range with "..", e.g. ["1..3"]
  • Range with "-", e.g. ["1-3"]

These 4 examples will result in the same result.


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@ljoss17 ljoss17 requested a review from romac June 20, 2024 11:13
@romac
Copy link
Member

romac commented Jun 21, 2024

I am a bit wary of supporting both .. and ..= with the same semantics, given that in Rust these mean exclusive and inclusive upper bound, respectively. Granted, it's probably not common knowledge outside of Rust programmers.

Still, I would rather we keep a single syntax for defining ranges. How about keeping only -, as it does not collide with Rust ranges, and does not require users to ponder about whether or not it's inclusive or exclusive, provided that we make it explicit in the config file.

What do you think @ljoss17?

config.toml Outdated Show resolved Hide resolved
Copy link
Member

@romac romac left a comment

Choose a reason for hiding this comment

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

See comments above. Great job otherwise!

@ljoss17
Copy link
Contributor Author

ljoss17 commented Jun 21, 2024

I am a bit wary of supporting both .. and ..= with the same semantics, given that in Rust these mean exclusive and inclusive upper bound, respectively. Granted, it's probably not common knowledge outside of Rust programmers.

Still, I would rather we keep a single syntax for defining ranges. How about keeping only -, as it does not collide with Rust ranges, and does not require users to ponder about whether or not it's inclusive or exclusive, provided that we make it explicit in the config file.

What do you think @ljoss17?

I agree, having a single separator will make it cleaner. Yes the - seems the best option.

@ljoss17 ljoss17 added this pull request to the merge queue Jun 21, 2024
Merged via the queue into master with commit b9b6663 Jun 21, 2024
31 checks passed
@ljoss17 ljoss17 deleted the luca_joss/improve-excluded-sequences-config branch June 21, 2024 10:17
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.

Allow ranges for excluded_sequences config option
2 participants