Skip to content

Commit

Permalink
lint: add annotation for tags in config.json
Browse files Browse the repository at this point in the history
If a track's `config.json` file does not have valid tags, the error
message will now also show an annotation which explains to the user
what exactly is wrong and how to fix it.
  • Loading branch information
ErikSchierboom committed Feb 24, 2022
1 parent cf70d5f commit 09d5108
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lint/track_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,14 @@ const tags = [
].toHashSet()

proc hasValidTags(data: JsonNode; path: Path): bool =
const errorAnnotation = """
Tracks are annotated with tags to allow searching for tracks with certain tags.
Tags must be chosen from our list of supported tags.
Tags should be selected based on the general usage of their language.
For more information on tags and the list of supported tags see:
https://exercism.org/docs/building/tracks/config-json#h-tags""".unindent()
result = hasArrayOfStrings(data, "tags", path, allowed = tags,
uniqueValues = true)
uniqueValues = true, errorAnnotation = errorAnnotation)

proc satisfiesFirstPass(data: JsonNode; path: Path): bool =
## Returns `true` if `data` passes the first round of checks for a track-level
Expand Down

0 comments on commit 09d5108

Please sign in to comment.