Skip to content

Commit 0d43e27

Browse files
ee7ErikSchierboom
andauthored
lint: flatten authors and contributors (#230)
This commit also makes `authors` optional for practice exercises. See: - exercism/docs#88 Co-authored-by: Erik Schierboom <[email protected]>
1 parent 7cafddb commit 0d43e27

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

src/lint/concept_exercises.nim

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import std/[json, os]
22
import ".."/helpers
33
import "."/validators
44

5-
proc isValidAuthorOrContributor(data: JsonNode, context: string, path: string): bool =
6-
if isObject(data, context, path):
7-
result = true
8-
if not checkString(data, "github_username", path):
9-
result = false
10-
if not checkString(data, "exercism_username", path, isRequired = false):
11-
result = false
12-
135
proc checkFiles(data: JsonNode, context, path: string): bool =
146
result = true
157
if hasObject(data, context, path):
@@ -25,10 +17,9 @@ proc checkFiles(data: JsonNode, context, path: string): bool =
2517
proc isValidConceptExerciseConfig(data: JsonNode, path: string): bool =
2618
if isObject(data, "", path):
2719
result = true
28-
if not hasArrayOf(data, "authors", path, isValidAuthorOrContributor):
20+
if not hasArrayOfStrings(data, "", "authors", path):
2921
result = false
30-
if not hasArrayOf(data, "contributors", path, isValidAuthorOrContributor,
31-
isRequired = false):
22+
if not hasArrayOfStrings(data, "", "contributors", path, isRequired = false):
3223
result = false
3324
if not checkFiles(data, "files", path):
3425
result = false

src/lint/practice_exercises.nim

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import std/[json, os]
22
import ".."/helpers
33
import "."/validators
44

5-
proc isValidAuthorOrContributor(data: JsonNode, context: string, path: string): bool =
6-
if isObject(data, context, path):
7-
result = true
8-
if not checkString(data, "github_username", path):
9-
result = false
10-
if not checkString(data, "exercism_username", path, isRequired = false):
11-
result = false
12-
135
proc checkFiles(data: JsonNode, context, path: string): bool =
146
result = true
157
if hasObject(data, context, path):
@@ -25,12 +17,9 @@ proc checkFiles(data: JsonNode, context, path: string): bool =
2517
proc isValidPracticeExerciseConfig(data: JsonNode, path: string): bool =
2618
if isObject(data, "", path):
2719
result = true
28-
# Temporarily disable the checking of authors as we'll be doing bulk PRs
29-
# to pre-populate this field for all tracks
30-
# if not hasArrayOf(data, "authors", path, isValidAuthorOrContributor):
31-
# result = false
32-
if not hasArrayOf(data, "contributors", path, isValidAuthorOrContributor,
33-
isRequired = false):
20+
if not hasArrayOfStrings(data, "", "authors", path, isRequired = false):
21+
result = false
22+
if not hasArrayOfStrings(data, "", "contributors", path, isRequired = false):
3423
result = false
3524
# Temporarily disable the checking of the files to give tracks the chance
3625
# to update this manually

0 commit comments

Comments
 (0)