-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add a negate flag #15
Comments
---
# https://semver.org/#is-v123-a-semantic-version
- name: VERSION files must contain semver.
# LOLWAT? https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
pattern: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
hint: "https://semver.org/#is-v123-a-semantic-version"
filePattern: '.*VERSION'
- name: VERSION file contents must not be prefixed with a v
pattern: '^v'
hint: "https://semver.org/#is-v123-a-semantic-version"
filePattern: '.*VERSION'
I want that file to fail both rules, not just the 2nd one. |
(and the LOLWAT refers to the regex itself ;) ) |
Hi @petemounce thanks for reaching out. I see your point, how this might come in handy. However, I am not 100% sure on how to integrate this, since we currently work with matches, that have line numbers and snippets, that are being displayed. Inverse matches would mean we only had file names. Anyhow, I still think it's possible to come up with a good solution. How about you propose a solution. Preferably as a pull-request and I will gladly review and release it. Best |
Hi @petemounce ,
This won't match the correct versioning string but will trigger everything else. |
We have a similar challenge on our side. Here is the generalized idea:
Simple/silly example:
What I would propose:
So the solution to the above would become: pattern: 'ABC.*' # or maybe 'ABC.{3}'
mustMatch: 'ABC((DEF)|(123))' And @petemounce, the solution for you could probably look something like this (although I'm probably missing a lot of details): pattern: '[^\d]\d+\.\d+\.\d+[^\d]'
mustMatch: '[^v]\d+\.\d+\.\d+' # or maybe '"\d+\.\d+\.\d+"' So much simpler. 💙 @petemounce, @codingjoe: What do you think? |
Hm… that is an interesting idea. I like the concept of either looking for something that shouldn't be there, or should. I'd love to see this included in a new version. Heck, I'd actually love to implement path to test functions written in Python, like I believe it's time for a new major release, with some exciting new features and maybe some breaking changes. If anyone is interested in contributing, please let me know. |
I would like to add a rule that fails when a regex is not matched, for example a
VERSION
file containing av1.0.0
and a pattern like^v
(because a v prefix on a semver is not valid).The text was updated successfully, but these errors were encountered: