Skip to content
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(track_config): warn for empty practices and Practice Exercise prereqs #428

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Sep 16, 2021

With this PR, configlet lint now checks that a track-level
config.json file follows the below rules:

  • The exercises.practice[].practices value must be a non-empty array
    of strings if exercises.practice[].status is not equal to
    deprecated
  • The exercises.practice[].prerequisites value must be a non-empty
    array of strings if exercises.practice[].status is not equal to
    deprecated

The checks are currently implemented as a warning. That is, a violation
does not by itself cause configlet to exit with a non-zero exit code.


@ErikSchierboom How should we approach this? Populating the values in these arrays is a lot of work, and many tracks don't even have concepts to populate them with. Should we maybe enable it as a warning only for tracks that set status.concept_exercises to true?

Currently this PR just prints the count, rather than each slug. I did this to reduce the verbosity, and because a maintainer probably fixes this by searching for "practices", not for each slug. But maybe printing the slugs makes more sense if we somehow warn only for tracks that have a small number of empty practices and Practice Exercise prerequisites.

One issue is that we might want a different timeline for these warnings than that shown in the current warning message:

Configlet produced at least one warning.
These warnings will become errors in a future configlet release (at the end of October 2021).

Aside: the proc that this PR touches now handles Concept and Practice Exercises differently enough that a combined proc doesn't help much to reduce duplication.


This PR currently produces the below diff to the output of configlet lint, per track:

babashka

+Warning: 76 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 75 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

bash

+Warning: 89 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 88 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

c

+Warning: 71 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 70 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

cfml

+Warning: 28 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 27 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

clojure

+Warning: 30 user-facing Practice Exercises have an empty `practices` array:
+./config.json

clojurescript

+Warning: 26 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 25 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

coffeescript

+Warning: 21 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 20 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

common-lisp

+Warning: 1 user-facing Practice Exercises have an empty `practices` array:
+./config.json

cpp

+Warning: 55 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 54 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

crystal

+Warning: 50 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 49 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

csharp

+Warning: 1 user-facing Practice Exercises have an empty `practices` array:
+./config.json

d

+Warning: 34 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 33 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

dart

+Warning: 37 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 36 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

delphi

+Warning: 76 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 75 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

elixir

+Warning: 5 user-facing Practice Exercises have an empty `practices` array:
+./config.json

elm

+Warning: 46 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 45 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

emacs-lisp

+Warning: 28 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 27 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

erlang

+Warning: 77 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 76 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

fortran

+Warning: 21 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 20 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

fsharp

+Warning: 14 user-facing Practice Exercises have an empty `practices` array:
+./config.json

gleam

+Warning: 5 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 4 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

go

+Warning: 109 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 108 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

groovy

+Warning: 55 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 54 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

haskell

+Warning: 96 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 95 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

java

+Warning: 114 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 113 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

javascript

+Warning: 107 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 83 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

julia

+Warning: 50 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 49 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

kotlin

+Warning: 84 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 83 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

lfe

+Warning: 31 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 30 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

lua

+Warning: 82 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 81 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

mips

+Warning: 15 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 14 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

nim

+Warning: 67 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 66 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

objective-c

+Warning: 51 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 50 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

ocaml

+Warning: 44 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 43 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

perl5

+Warning: 62 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 61 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

pharo-smalltalk

+Warning: 42 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 41 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

php

+Warning: 75 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 74 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

plsql

+Warning: 11 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 10 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

prolog

+Warning: 19 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 18 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

purescript

+Warning: 28 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 27 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

python

+Warning: 20 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 2 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

r

+Warning: 35 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 34 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

racket

+Warning: 33 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 32 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

raku

+Warning: 30 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 29 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

reasonml

+Warning: 24 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 23 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

ruby

+Warning: 3 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 1 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

rust

+Warning: 93 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 92 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

scala

+Warning: 91 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 90 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

scheme

+Warning: 39 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 38 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

shen

+Warning: 1 user-facing Practice Exercises have an empty `practices` array:
+./config.json

sml

+Warning: 27 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 26 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

swift

+Warning: 83 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 82 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

tcl

+Warning: 120 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 119 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

typescript

+Warning: 93 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 92 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

vbnet

+Warning: 13 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 12 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

vimscript

+Warning: 20 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 19 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

wren

+Warning: 19 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 51 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

x86-64-assembly

+Warning: 16 user-facing Practice Exercises have an empty `practices` array:
+./config.json
+
+Warning: 15 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

z3

+Warning: 1 user-facing Practice Exercises have an empty `prerequisites` array:
+./config.json

With this commit, `configlet lint` now checks that a track-level
`config.json` file follows the below rule:

- The `exercises.practice[].practices` value must be a non-empty array
  of strings if `exercises.practice[].status` is not equal to
  `deprecated`

The check is currently implemented as a warning. That is, a violation
does not by itself cause configlet to exit with a non-zero exit code.
With this commit, `configlet lint` now checks that a track-level
`config.json` file follows the below rule:

- The `exercises.practice[].prerequisites` value must be a non-empty
  array of strings if `exercises.practice[].status` is not equal to
  `deprecated`

The check is currently implemented as a warning. That is, a violation
does not by itself cause configlet to exit with a non-zero exit code.
@ErikSchierboom
Copy link
Member

How should we approach this? Populating the values in these arrays is a lot of work, and many tracks don't even have concepts to populate them with. Should we maybe enable it as a warning only for tracks that set status.concept_exercises to true?

I think only enabling this as a warning for tracks with .status.concept_exercises == true makes total sense. At some point we do want to have the practices field filled in for tracks with .status.concept_exercises == false, but that's a way off I think.

This is the current status of tracks with concept exercises:

clojure: 76 total, 0 no prerequisites
common-lisp: 43 total, 0 no prerequisites
csharp: 126 total, 0 no prerequisites
elixir: 118 total, 0 no prerequisites
elm: 46 total, 45 no prerequisites
fsharp: 123 total, 0 no prerequisites
go: 114 total, 108 no prerequisites
java: 120 total, 113 no prerequisites
javascript: 113 total, 84 no prerequisites
python: 129 total, 2 no prerequisites
ruby: 103 total, 1 no prerequisites
rust: 96 total, 92 no prerequisites
swift: 87 total, 82 no prerequisites

We plan on doing PRs to have at least some prerequisites for most tracks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants