Repository navigation
Fix skills.sh.json to match the skills.sh schema #255
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,7 @@ import 'package:skills_lint/skills_lint.dart'; | |||||||||||||||||||
| import 'package:test/test.dart'; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const String _expectedSkillsShSchema = | ||||||||||||||||||||
| 'https://skills.sh/schemas/skills.sh.json'; | ||||||||||||||||||||
| 'https://skills.sh/schemas/skills.sh.schema.json'; | ||||||||||||||||||||
| const int _maxGroupTitleLength = 30; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| void _validateGroupTitle(Object? title) { | ||||||||||||||||||||
|
|
@@ -80,23 +80,35 @@ void main() { | |||||||||||||||||||
| jsonDecode(skillsShFile.readAsStringSync()) as Map<String, Object?>; | ||||||||||||||||||||
| expect(skillsShJson[r'$schema'], _expectedSkillsShSchema); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // The skills.sh schema sets additionalProperties: false, so unknown keys | ||||||||||||||||||||
| // (such as a misspelled "groups") make skills.sh ignore the file. | ||||||||||||||||||||
| expect( | ||||||||||||||||||||
| skillsShJson.keys, | ||||||||||||||||||||
| everyElement(isIn([r'$schema', 'groupings', 'notGrouped'])), | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Setting notGrouped to "bottom" instructs skills.sh to render any skill | ||||||||||||||||||||
| // not listed in "groups" (including previously deleted/renamed skill slugs | ||||||||||||||||||||
| // retained in skills.sh install telemetry and synced dart-* copies) under | ||||||||||||||||||||
| // not listed in "groupings" (including previously deleted/renamed skill | ||||||||||||||||||||
| // slugs retained in skills.sh install telemetry and synced dart-* copies) | ||||||||||||||||||||
| // under | ||||||||||||||||||||
| // its built-in "Other skills" heading at the bottom of the repository page | ||||||||||||||||||||
| // (the schema only accepts "top", "bottom", or "hidden", and does not | ||||||||||||||||||||
| // (the schema only accepts "top" or "bottom", and does not | ||||||||||||||||||||
| // support a custom label). | ||||||||||||||||||||
| expect(skillsShJson['notGrouped'], 'bottom'); | ||||||||||||||||||||
| expect(skillsShJson.keys.last, 'notGrouped'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // 3. Validate each group's title, description, and unique skill | ||||||||||||||||||||
| // identifiers, and ensure that all grouped skills exist as flutter-* | ||||||||||||||||||||
| // directories in skills/ (without typos or missing skills). | ||||||||||||||||||||
| final groups = (skillsShJson['groups'] as List<Object?>) | ||||||||||||||||||||
| final groups = (skillsShJson['groupings'] as List<Object?>) | ||||||||||||||||||||
| .cast<Map<String, Object?>>(); | ||||||||||||||||||||
|
Comment on lines
+103
to
104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To prevent cryptic
Suggested change
|
||||||||||||||||||||
| expect(groups, isNotEmpty); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| for (final group in groups) { | ||||||||||||||||||||
| expect( | ||||||||||||||||||||
| group.keys, | ||||||||||||||||||||
| everyElement(isIn(['title', 'description', 'skills'])), | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
Comment on lines
+108
to
+111
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we validate that the keys of each group only contain allowed properties, we should also explicitly assert that the required
Suggested change
|
||||||||||||||||||||
| _validateGroupTitle(group['title']); | ||||||||||||||||||||
| _validateGroupDescription(group['description']); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
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.
Best I can tell this url did not exist.