Skip to content

Commit 3171b11

Browse files
authored
lint: refactor final output message (#503)
Changes: - Indent contents of triple-quoted string literals, using `unindent` or `dedent`. This improves readability, and consistency with other code. - Move a block of code, to clarify that we currently only print the message about warnings when there were warnings but no errors.
1 parent 6033961 commit 3171b11

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

src/lint/lint.nim

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,40 @@ proc allChecksPass(trackDir: Path): bool =
2222
result = allTrue(checks)
2323

2424
proc lint*(conf: Conf) =
25-
echo "The lint command is under development.\n" &
26-
"Please re-run this command regularly to see if your track passes " &
27-
"the latest linting rules.\n"
25+
echo """
26+
The lint command is under development.
27+
Please re-run this command regularly to see if your track passes the latest linting rules.
28+
""".unindent()
2829

2930
let trackDir = Path(conf.trackDir)
3031

3132
const url = "https://github.com/exercism/docs/blob/main/building/configlet/lint.md"
3233

3334
if allChecksPass(trackDir):
3435
echo """
35-
Basic linting finished successfully:
36-
- config.json exists and is valid JSON
37-
- config.json has these valid fields:
38-
language, slug, active, blurb, version, status, online_editor, key_features, tags
39-
- Every concept has the required .md files
40-
- Every concept has a valid links.json file
41-
- Every concept has a valid .meta/config.json file
42-
- Every concept exercise has the required .md files
43-
- Every concept exercise has a valid .meta/config.json file
44-
- Every practice exercise has the required .md files
45-
- Every practice exercise has a valid .meta/config.json file
46-
- Required track docs are present
47-
- Required shared exercise docs are present"""
36+
Basic linting finished successfully:
37+
- config.json exists and is valid JSON
38+
- config.json has these valid fields:
39+
language, slug, active, blurb, version, status, online_editor, key_features, tags
40+
- Every concept has the required .md files
41+
- Every concept has a valid links.json file
42+
- Every concept has a valid .meta/config.json file
43+
- Every concept exercise has the required .md files
44+
- Every concept exercise has a valid .meta/config.json file
45+
- Every practice exercise has the required .md files
46+
- Every practice exercise has a valid .meta/config.json file
47+
- Required track docs are present
48+
- Required shared exercise docs are present""".dedent()
49+
if printedWarning:
50+
echo ""
51+
const msg = """
52+
Configlet produced at least one warning.
53+
These warnings might become errors in a future configlet release.
54+
For more information, please see the documentation:""".unindent()
55+
warn(msg, url, doubleFinalNewline = false)
4856
else:
49-
echo &"""
50-
Configlet detected at least one problem.
51-
For more information on resolving the problems, please see the documentation:
52-
{url}"""
57+
echo fmt"""
58+
Configlet detected at least one problem.
59+
For more information on resolving the problems, please see the documentation:
60+
{url}""".unindent()
5361
quit(1)
54-
55-
if printedWarning:
56-
echo ""
57-
const msg = """
58-
Configlet produced at least one warning.
59-
These warnings might become errors in a future configlet release.
60-
For more information, please see the documentation:""".unindent()
61-
warn(msg, url, doubleFinalNewline = false)

0 commit comments

Comments
 (0)