Add a negate flag #110
Replies: 8 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. |
Beta Was this translation helpful? Give feedback.
-
(and the LOLWAT refers to the regex itself ;) ) |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
Hi @petemounce ,
This won't match the correct versioning string but will trigger everything else. |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Quick idea: reLint could look for a file called The functions should probably have a signature along the line of
Related: Open question: what kind of return value would reLint expect? 🤔 Returning an object would probably offer the most flexibility, because then new key-values could easily be added in the future (since we cannot possibly predict every need). |
Beta Was this translation helpful? Give feedback.
-
Hi there 👋, Yes, the idea of adding declarative tests has been floating around for a while. I am not opposed to the idea. However, I feature can coexist on their own. Don't hesitate to open a separate issue or discussion for such a feature. Cheers! |
Beta Was this translation helpful? Give feedback.
-
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).Beta Was this translation helpful? Give feedback.
All reactions