-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
lint: add kebab-case checks #274
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit implements these checks for a track `config.json`: - The `"slug"` value must be a non-empty, non-blank, lowercased string using kebab-case - The `"exercises.concept[].slug"` value must be a non-empty, non-blank, lowercased string using kebab-case - The `"exercises.concept[].concepts"` values must be non-empty, non-blank, lowercased strings using kebab-case - The `"exercises.concept[].prerequisites"` values must be non-empty, non-blank, lowercased strings using kebab-case - The `"exercises.practice[].slug"` value must be a non-empty, non-blank, lowercased string using kebab-case - The `"exercises.practice[].practices"` values must be non-empty, non-blank, lowercased strings using kebab-case - The `"exercises.practice[].prerequisites"` values must be non-empty, non-blank, lowercased strings using kebab-case - The `"exercises.foregone"` values must be non-empty, non-blank, lowercased strings using kebab-case - The `"concepts[].slug"` value must be a non-empty, non-blank, lowercased string using kebab-case
0b2eb58
to
e898324
Compare
ee7
commented
Apr 9, 2021
Option 1 is what we want. I'll update the docs to clarify. |
ErikSchierboom
approved these changes
Apr 9, 2021
ErikSchierboom
approved these changes
Apr 9, 2021
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.
Love the extensive tests!
It doesn't like aligned comments.
This fixes the formatting of the doc comment when it appears as a pop-up in a text editor.
This was referenced Apr 10, 2021
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit implements some stricter checks for the track-level
config.json
file.configlet lint
now checks that every value of every below key is a"kebab-case string":
slug
exercises.concept[].slug
exercises.concept[].concepts
exercises.concept[].prerequisites
exercises.practice[].slug
exercises.practice[].practices
exercises.practice[].prerequisites
exercises.foregone
concepts[].slug
We define a "kebab-case string" as a string that matches the regular
expression:
^[a-z0-9]+(-[a-z0-9]+)*$
See:
This PR currently causes the following diff to the output of
configlet lint
:rust
What should the definition of "kebab string" be?
A string that only contains characters in{'a'..'z', '0'..'9', '-'}
(the definition in e898324)^([a-z0-9]+)(-[a-z0-9]+)*$
A string that does not contain a character in{'A'..'Z', '_', ' '}
Something elseI think we can either
Allow special characters in a concept name, so something like&str
is allowed, but disallow them in the other kebab strings.See e.g.