-
-
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: implement remaining linting rules #249
Labels
Comments
This was referenced May 9, 2021
ee7
added
cmd: lint
priority: high
More important
kind: feature
User-facing enhancement
labels
May 9, 2021
bobtfish
added a commit
to bobtfish/Exercism-configlet
that referenced
this issue
Oct 5, 2021
The "exercises.practice[].status" value must, if "exercises.practice[].slug" is equal to hello-world, be either omitted or the string active Refs: exercism#249
bobtfish
added a commit
to bobtfish/Exercism-configlet
that referenced
this issue
Oct 6, 2021
The "exercises.practice[].status" value must, if "exercises.practice[].slug" is equal to hello-world, be either omitted or the string active Refs: exercism#249
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue will try to track which linting rules are implemented in the latest
configlet
release, and to what extent. This issue was last updated forconfiglet 4.0.0-alpha.34
.The list below is from the spec (up to date with exercism/docs@322d63e). When we change the spec, we should remember to make the same changes in the below.
For the near future, I will handle the implementation of the JSON rules.
A ticked checkbox means that the item is fully implemented. An empty checkbox means the item is unimplemented or only partially implemented.
Backlog:
4.0.0-alpha.34...4.0.0-beta.2
git log 4.0.0-alpha.34..4.0.0-beta.2 --oneline -- src/lint*
152a953 lint, sync, fmt: support the
files.invalidator
field0832f81 lint(exercises): check
files.editor
field4ab7a53 remove trailing whitespace
d0cd08c lint: error on missing concept/exercise files
a71637f lint: add annotation for key features in config.json
09d5108 lint: add annotation for tags in config.json
cf70d5f validators: pass error annotation to
hasValidRuneLength
856ad41 lint: link to docs on exercism.org, not GitHub
aa22e35 lint: allow overlap of solution and test files for
d
andplsql
tracksfea7bcc lint: allow overlap of
files.example
andfiles.exemplar
values3a55f57 lint: support error annotations
fe3e7e4 lint: clarify the need to update configlet
3171b11 lint: refactor final output message
816a118 lint: advise that warnings may not become errors
fd78c1b lint(track_config): optimize concept cycle checking slightly
1fd2a46 sync: handle docs, metadata, and filepaths
Rule: required files are present
The linter should check if all the required files are present. The non-exercise specific files that must be present are:
config.json
docs/ABOUT.md
docs/INSTALLATION.md
docs/LEARNING.md
docs/RESOURCES.md
docs/SNIPPET.txt
docs/TESTS.md
exercises/shared/.docs/help.md
exercises/shared/.docs/tests.md
The Concept Exercise specific files that must be present are:
exercises/concept/<slug>/.docs/hints.md
exercises/concept/<slug>/.docs/instructions.md
exercises/concept/<slug>/.docs/introduction.md
exercises/concept/<slug>/.meta/config.json
The Practice Exercise specific files that must be present are at least (not yet in the spec):
exercises/practice/<slug>/.docs/instructions.md
exercises/practice/<slug>/.meta/config.json
Each concept listed in the
config.json
should have the following files:concepts/<slug>/about.md
concepts/<slug>/introduction.md
concepts/<slug>/links.json
Rule:
config.json
file is validThe
config.json
file should have the following checks:"language"
key is required"language"
value must be a non-blank string¹ with length <= 255"slug"
key is required"slug"
value must be a kebab-case string² with length <= 255"active"
key is required"active"
value must be a boolean"blurb"
key is required"blurb"
value must be a non-blank string¹ with length <= 400"version"
key is required"version"
value must be the integer3
"status.concept_exercises"
key is required"status.concept_exercises"
value must be a boolean"status.test_runner"
key is required"status.test_runner"
value must be a boolean"status.representer"
key is required"status.representer"
value must be a boolean"status.analyzer"
key is required"status.analyzer"
value must be a boolean"online_editor.indent_style"
key is required"online_editor.indent_style"
value must be the stringspace
ortab
"online_editor.indent_size"
key is required"online_editor.indent_size"
value must be an integer >= 0 and <= 8"online_editor.highlightjs_language"
key is required"online_editor.highlightjs_language"
value must be a non-blank string¹"files"
key is optional"files"
value must be an object"files.solution
" key is optional"files.solution
" value must be an array"files.solution
" values must be valid patterns⁵"files.solution
" values must not have duplicates"files.test
" key is optional"files.test
" value must be an array"files.test
" values must be valid patterns⁵"files.test
" values must not have duplicates"files.example
" key is optional"files.example
" value must be an array"files.example
" values must be valid patterns⁵"files.example
" values must not have duplicates"files.exemplar"
key is optional"files.exemplar"
value must be an array"files.exemplar"
values must be valid patterns⁵"files.exemplar"
values must not have duplicates"files.editor
" key is optional"files.editor
" value must be an array"files.editor
" values must be valid patterns⁵"files.editor
" values must not have duplicates"files.invalidator
" key is optional"files.invalidator
" value must be an array"files.invalidator
" values must be valid patterns⁵"files.invalidator
" values must not have duplicates"files.solution"
,"files.test"
,"files.example"
,"files.exemplar"
,"files.editor"
or"files.invalidator"
array (no overlap)d
orplsql
, the"files.solution"
and"files.test"
files can overlap"files.example"
and"files.exemplar"
files can overlap"test_runner.average_run_time"
key is required ifstatus.test_runner
is equal totrue
"test_runner.average_run_time"
value must be a floating-point number > 0 with one decimal point of precision"exercises"
key is required"exercises.concept"
key is required"exercises.concept"
value must be an array"exercises.concept[].slug"
key is required"exercises.concept[].slug"
value must be a kebab-case string² with length <= 255"exercises.concept[].slug"
value must be unique in"exercises.concept[].slug"
and may not exist in"exercises.practice[].slug"
"exercises.concept[].name"
key is required"exercises.concept[].name"
value must be a Title Case string³ with length <= 255"exercises.concept[].uuid"
key is required"exercises.concept[].uuid"
value must be a unique version 4 UUID string⁶"exercises.concept[].uuid"
value for each exercise must never change"exercises.concept[].concepts"
key is required"exercises.concept[].concepts"
value must be a non-empty array of strings if"exercises.concept[].status"
is not equal todeprecated
"exercises.concept[].concepts"
value must be an empty array if"exercises.concept[].status"
is equal todeprecated
"exercises.concept[].concepts"
values must be kebab-case strings²"exercises.concept[].concepts"
values must not have duplicates"exercises.concept[].concepts"
values must not be in any other concept exercise's"concepts"
property"exercises.concept[].concepts"
values must match the"concepts.slug"
property of one of the concepts"exercises.concept[].prerequisites"
key is required"exercises.concept[].prerequisites"
value must be a non-empty array of strings if"exercises.concept[].status"
is not equal todeprecated
, except for exactly one exercise which is allowed to have an empty array as its value"exercises.concept[].prerequisites"
value must be an empty array if"exercises.concept[].status"
is equal todeprecated
"exercises.concept[].prerequisites"
values must be kebab-case strings²"exercises.concept[].prerequisites"
values must not have duplicates"exercises.concept[].prerequisites"
values must match any other concept exercise's"concepts"
property values"exercises.concept[].prerequisites"
values must not match any of the values in the exercise's"exercises.concept[].concepts"
property"exercises.concept[].prerequisites"
values must match the"concepts.slug"
property of one of the concepts"exercises.concept[].concepts"
and"exercises.concept[].prerequisites"
"exercises.concept[].status"
key is optional"exercises.concept[].status"
value must be the stringwip
,beta
,active
ordeprecated
"exercises.practice"
key is required"exercises.practice"
value must be an array"exercises.practice[].slug"
key is required"exercises.practice[].slug"
value must be a kebab-case string² with length <= 255"exercises.practice[].slug"
value must be unique in"exercises.practice[].slug"
and may not exist in"exercises.concept[].slug"
"exercises.practice[].slug"
value that is the stringhello-world
"exercises.practice[].name"
key is required"exercises.practice[].name"
value must be a Title Case string³ with length <= 255"exercises.practice[].uuid"
key is required"exercises.practice[].uuid"
value must be a unique version 4 UUID string⁶"exercises.practice[].uuid"
value for each exercise must never change"exercises.practice[].difficulty"
key is required"exercises.practice[].difficulty"
value must be an integer >= 1 and <= 10"exercises.practice[].practices"
key is required"exercises.practice[].practices"
value must be a non-empty array of strings if"exercises.practice[].status"
is not equal todeprecated
(TODO: enable this supported check)"exercises.practice[].practices"
value must be an empty array if"exercises.practice[].status"
is equal todeprecated
"exercises.practice[].practices"
values must be kebab-case strings²"exercises.practice[].practices"
values must not have duplicates"exercises.practice[].practices"
values must match the"concepts[].slug"
property of one of the concepts (TODO: this is currently implemented as a warning, and will become an error)"exercises.practice[].practices"
values must refer to an individual concept's slug at most 10 times (across all exercises) (TODO: this is currently implemented as a warning, and will become an error)"exercises.practice[].prerequisites"
key is required"exercises.practice[].prerequisites"
value must be a non-empty array of strings if"exercises.practice[].status"
is not equal todeprecated
(TODO: enable this supported check)"exercises.practice[].prerequisites"
value must be an empty array if"exercises.practice[].status"
is equal todeprecated
"exercises.practice[].prerequisites"
value must be an empty array if"exercises.practice[].slug"
is equal tohello-world
"exercises.practice[].prerequisites"
values must be kebab-case strings²"exercises.practice[].prerequisites"
values must not have duplicates"exercises.practice[].prerequisites"
values must match any concept exercise's"exercises.concept[].concepts"
values (TODO: this is currently implemented as a warning, and will become an error)"exercises.practice[].prerequisites"
values must match the"concepts[].slug"
property of one of the concepts (TODO: this is currently implemented as a warning, and will become an error)"exercises.practice[].status"
key is optional"exercises.practice[].status"
value must be the stringwip
,beta
,active
ordeprecated
"exercises.practice[].status"
value must, if"exercises.practice[].slug"
is equal tohello-world
, be either omitted or the stringactive
"exercises.foregone"
key is optional"exercises.foregone"
value must be an array"exercises.foregone"
values must be kebab-case strings²"exercises.foregone"
values must not have duplicates"exercises.foregone"
values must not match any of the concept or practice exercise slugs"concepts"
key is required"concepts"
value must be an array"concepts[].uuid"
key is required"concepts[].uuid"
value must be a unique version 4 UUID string⁶"concepts[].uuid"
value for each concept must never change"concepts[].slug"
key is required"concepts[].slug"
value must be a kebab-case string² with length <= 255"concepts[].name"
key is required"concepts[].name"
value must be a Title Case string³ with length <= 255"concepts"
value must have aconcept/<concepts.slug>/about.md
file. Linting rules for this file are specified below."concepts"
value must have aconcept/<concepts.slug>/introduction.md
file. Linting rules for this file are specified below."concepts"
value must have aconcept/<concepts.slug>/links.json
file. Linting rules for this file are specified below."key_features"
key is optional"key_features"
value must be an array with length = 6"key_features[].icon"
key is required"key_features[].icon"
value must use one of the pre-defined icon values"key_features[].title"
key is required"key_features[].title"
value must be a Sentence Case string⁴ with length <= 25"key_features[].content"
key is required"key_features[].content"
value must be a non-blank string¹ with length <= 100"tags"
key is required"tags"
value must be an array of strings"tags"
values must not have duplicates"tags"
values must use one of the pre-defined tag valuesRule:
exercises/concept/<slug>/.meta/config.json
is valid"blurb"
key is required"blurb"
value must be a non-blank string¹ with length <= 350"source"
key is optional"source"
value must be a non-blank string¹"source_url"
key is optional"source_url"
value must be a URL"authors"
key is required"authors"
value must be a non-empty array"authors"
values must be non-blank strings¹"authors"
values must not have duplicates"authors"
values are treated case-insensitively"contributors"
key is optional"contributors"
value must be an array"contributors"
values must be non-blank strings¹"contributors"
values must not have duplicates"contributors"
values are treated case-insensitively"authors"
or"contributors"
array (no overlap)"files.solution"
key is required"files.solution"
value must be a non-empty array"files.solution"
values must not have duplicates"files.test"
key is required"files.test"
value must be a non-empty array"files.test"
values must not have duplicates"files.exemplar"
key is required"files.exemplar"
value must be a non-empty array"files.exemplar"
values must not have duplicates"files.editor"
key is optional"files.editor"
value must be an array"files.editor"
values must not have duplicates"files.invalidator"
key is optional"files.invalidator"
value must be an array"files.invalidator"
values must not have duplicates"files.solution"
must exist"files.test"
must exist"files.exemplar"
must exist"files.editor"
must exist"files.invalidator"
must exist"files.solution"
,"files.test"
,"files.exemplar"
or"files.invalidator"
array (no overlap)d
orplsql
, the"files.solution"
and"files.test"
files can overlap"forked_from"
key is optional"forked_from"
value must be an array"forked_from"
values must be strings formatted as<track-slug>/<exercise-slug>
(e.g.fsharp/bird-watcher
)"forked_from"
values must refer to actually implemented exercises"forked_from"
values must not have duplicates"language_versions"
key is optional"language_versions"
value must be a string"icon"
key is optional"icon"
value must be a kebab-case string²Rule:
exercises/concept/<slug>/.docs/hints.md
is valid## General
or## X. <task>
whereX
matches the task number heading in theinstructions.md
Rule:
exercises/concept/<slug>/.docs/instructions.md
is valid## 1. Do X
Rule:
exercises/concept/<slug>/.docs/instructions.md.tpl
is valid (if present)"concepts.slug"
property of one of the concepts in the track'sconfig.json
.Rule:
exercises/concept/<slug>/.docs/introduction.md
is validRule:
exercises/practice/<slug>/.meta/config.json
is valid"blurb"
key is required"blurb"
value must be a non-blank string¹ with length <= 350"source"
key is optional"source"
value must be a non-blank string¹"source_url"
key is optional"source_url"
value must be a URL"authors"
key is optional"authors"
value must be an array"authors"
values must be non-blank strings¹"authors"
values must not have duplicates"authors"
values are treated case-insensitively"contributors"
key is optional"contributors"
value must be an array"contributors"
values must be non-blank strings¹"contributors"
values must not have duplicates"contributors"
values are treated case-insensitively"authors"
or"contributors"
array (no overlap)"files.solution"
key is required"files.solution"
value must be a non-empty array"files.solution"
values must not have duplicates"files.test"
key is required"files.test"
value must be a non-empty array"files.test"
values must not have duplicates"files.example"
key is required"files.example"
value must be a non-empty array"files.example"
values must not have duplicates"files.editor"
key is optional"files.editor"
value must be an array"files.editor"
values must not have duplicates"files.invalidator"
key is optional"files.invalidator"
value must be an array"files.invalidator"
values must not have duplicates"files.solution"
must exist"files.test"
must exist"files.example"
must exist"files.editor"
must exist"files.invalidator"
must exist"files.solution"
,"files.test"
,"files.example
or"files.invalidator"
array (no overlap)d
orplsql
, the"files.solution"
and"files.test"
files can overlap"language_versions"
key is optional"language_versions"
value must be a string"test_runner"
key is optional"test_runner"
value must be a booleanRule:
exercises/shared/.docs/debug.md
is validRule:
exercises/shared/.docs/help.md
is validRule:
exercises/shared/.docs/tests.md
is validRule:
concepts/<slug>/about.md
is validRule:
concepts/<slug>/introduction.md
is validRule:
concept/<slug>/links.json
is valid"[].url"
property is required"[].url"
value must be an URL"[].description"
property is required"[].description"
value must be a non-blank string¹"[].icon_url"
property is optional"[].icon_url"
value must be an URLRule:
concept/<slug>/.meta/config.json
is valid"blurb"
key is required"blurb"
value must be a non-blank string¹ with length <= 350"authors"
key is required"authors"
value must be an array"authors"
values must be non-blank strings¹"authors"
values must not have duplicates"authors"
values are treated case-insensitively"contributors"
key is optional"contributors"
value must be an array"contributors"
values must be non-blank strings¹"contributors"
values must not have duplicates"contributors"
values are treated case-insensitively"authors"
or"contributors"
array (no overlap)Rule:
docs/ABOUT.md
is validRule:
docs/INSTALLATION.md
is validRule:
docs/LEARNING.md
is validRule:
docs/RESOURCES.md
is validRule:
docs/SNIPPET.txt
is validRule:
docs/TESTS.md
is validGlossary
[a-z0-9]
, optionally separated by dashes (e.g. "two-fer"). It must match the regular expression:^[a-z0-9]+(-[a-z0-9]+)*$
files
pattern: A non-blank string¹ that specifies a location of a file used in an exercise, relative to the exercise's directory. A pattern may use one of the following placeholders:%{kebab_slug}
: thekebab-case
exercise slug (e.g.bit-manipulation
)%{snake_slug}
: thesnake_case
exercise slug (e.g.bit_manipulation
)%{camel_slug}
: thecamelCase
exercise slug (e.g.bitManipulation
)%{pascal_slug}
: thePascalCase
exercise slug (e.g.BitManipulation
)config.json
file of a given Exercism trackconfig.json
file of any other Exercism trackcanonical-data.json
file in https://github.com/exercism/problem-specificationsconfiglet uuid
to generate a suitable UUID.The text was updated successfully, but these errors were encountered: