-
Notifications
You must be signed in to change notification settings - Fork 94
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
restrict suite name character set #3274
Conversation
a6431eb
to
9fe7bc0
Compare
Answers (to Questions in issue description) (my opinion)
|
9fe7bc0
to
e0a3604
Compare
e0a3604
to
be5dac0
Compare
If no-one objects I'm going to go with those decisions. We can easily change the suite name rules later. In-case you wonder why I've implemented the suite name rules as a class, this is so it can be auto-documented in cylc-doc. |
No objection from me! Do you want Hilary as second reviewer or can I review? |
Please, go ahead! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code itself looks great & does as per the agreed spec outlined in the comments here from some testing with cylc register <suite-name>
.
Before merge, there's one typo (sorry, might as well correct it) & also while reviewing I've had a thought regarding one of the questions towards the validity rules, namely on leading characters (which would be trivial to change now in this implementation given its highly maintainable nature 🎆). I agree in general on:
- Prohibit - and . as the first character (as implemented)?
- yes, for aesthetic reasons
but besides this, a leading dot can have the functional purpose of making the suite directory hidden via the standard Unix filesystem display rules. Perhaps we could still allow this, as users may currently, or in future, want to utilise that in some way, e.g. to reduce clutter with "old" suites?
RULES = [] | ||
|
||
@classmethod | ||
def __init_subclass__(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a review comment, just pointing out something I found cool (so a review complement, I guess)! This method was new to me, so it was nice to learn a new Python feature by figuring out what its purpose was here, which was to add the rules returned from the methods applied inside RULES
into the doctring of any sub-class:
>>> print(SuiteNameValidator.__doc__)
The rules for valid suite names:
* must be between 1 and 254 characters long
* can not start with: ., -
* can only contain: alphanumeric, /, _, +, -, ., @
Nice!
That's an interesting idea @sadielbartholomew but I'm a bit concerned about making it easier for users to avoid housekeeping old suites, which has performance implications for "scan" functionality in the UI. On the other hand, I'm generally in favor of giving users the power to blow their own foot off if they really want to. Any other opinions on this? |
Co-Authored-By: Sadie L. Bartholomew <30274190+sadielbartholomew@users.noreply.github.com>
I can't really think of any legitimate reasons for having a hidden suite, I think it would be somewhat confusing if Doing a quick FS scan we don't currently have a single suite on site named with a leading dot so I can't imagine anyone would miss this. Interestingly, my FS scan did reveal 21 users with |
For sanity of those who do user support (i.e. us), I'd vote against hidden suites. |
In that case, I think we can merge this as-is... |
For Discussion
address "suite registration" point of #2979
Create a
unicode_rules
module:Questions
=
character? No%
character? No-
and.
as the first character (as implemented)? YesRequirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.