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

User-defined regex patterns for specification body options contains-issue-number and contains-url #592

Open
JuroOravec opened this issue Apr 13, 2020 · 0 comments

Comments

@JuroOravec
Copy link

Background

Hi, I've started using Zappr recently. I use it for commit check, spec check and approval check. I really like the idea of having the approval policy explicitly defined as a code. It reduces ambiguity, plus compared to having the policy in docs this doesn't run the risk of containing outdated info, so thanks for developing it!

For the spec check, I like the idea of checking for URL and issue reference in the body. Unfortunately, current implementation (true/false) are difficult to work with because:

  1. The specification.body.contains-url option would be more useful if one could specify which URL to search for.

    • Example: When a contributor sends a gif in the PR body, the check passes, although I might have been expecting a URL linking to the issue or other resource with well-defined URL.
  2. Similarly for specification.body.contains-issue-number, it would be good if user could change how the issue number is searched for in the body.

    • Example: In my setup, I want to enforce that a PR has to either reference an issue (e.g #42) or explicitly indicate that there's no issue accompanied no-issue. Additionally, some bot-created PRs like those by Dependabot don't contain reference to any issues, and the body text they use cannot be changed, so it would be also useful to be able to handle those cases, e.g. by looking for @dependabot.

Question

Would it be relevant and possible to allow the user to specify the regexes to search for in specification.body.contains-url and specification.body.contains-issue-number?

Suggestions

The code where the regexes are defined is here.

Possible implementation could be as follows:

  • if the option is set to true, use the default (current) regex (current behavior)
  • if the option is set to false, disable the check (current behavior)
  • if the option is string, interpret the string as the regex to use. (new behavior)
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

No branches or pull requests

1 participant