Closed Donnype closed 2 months ago
Approved because it's implemented as suggested in the issue ticket and includes well written tests. But in my opinion, we're overcomplicating it by using regex. The only advantage I see using regex is that we get free validation using
jsonschema
on the frontend side. This is a valid and reasonable advantage, but we might want to reconsider the complexity trade-off in future iterations.
I agree a regex is a horrible solution for this. however, its the only solution that fits inside the Schema, is somewhat declarative (our end goal for plugin definitions) and is usable in the backend, and frontend.
make reset
.feature
or hotfix
works as intended.Seems to work for the ports and ranges I tested. The ports I skipped also seem to be skipped in the raw file.
n/a
n/a
I think the regex can be shorter because as far as I can see we can remove some repetition. That would make it easier to understand, but the current one does work, so I am not sure if I should spend a little bit of time on this?
Changes
Adds regex pattern validation to the PORTS setting for
nmap-ports
. The only thing we cannot really check without exploding the pattern is if the left side of a1-20
style range is smaller than the right side, which I think is an OK edge case not to handle if we treat is as an empty list.See the unit test to see how the pattern is constructed:
Issue link
Closes https://github.com/minvws/nl-kat-coordination/issues/3143
Demo
See the unit tests for the behavior and how this pattern was constructed!
QA notes
Please check that in the UI bad patterns are not allowed for this settings!
Code Checklist
Checklist for code reviewers:
Copy-paste the checklist from the docs/source/templates folder into your comment.
Checklist for QA:
Copy-paste the checklist from the docs/source/templates folder into your comment.