Skip to content

Commit

Permalink
lint(track_config): fix error for missing track config (exercism#429)
Browse files Browse the repository at this point in the history
With the most recent configlet release (4.0.0-alpha.31), running
`configlet lint` using a directory that lacks a `config.json` file would
produce a segfault:

    The lint command is under development.
    Please re-run this command regularly to see if your track passes the latest linting rules.

    Missing file:
    /tmp/foo/config.json

    SIGSEGV: Illegal storage access. (Attempt to read from nil?)

With this commit, we again get something like (for an empty directory):

    The lint command is under development.
    Please re-run this command regularly to see if your track passes the latest linting rules.

    Missing file:
    /tmp/foo/config.json

    Missing directory:
    /tmp/foo/exercises/shared/.docs

    Missing directory:
    /tmp/foo/docs

    Configlet detected at least one problem.
    For more information on resolving the problems, please see the documentation:
    https://github.com/exercism/docs/blob/main/building/configlet/lint.md

The problem was introduced by commit e732894, and does not occur in
releases before 4.0.0-alpha.31.
  • Loading branch information
ee7 authored Oct 5, 2021
1 parent 3d21588 commit 06457bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lint/track_config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,5 @@ proc isTrackConfigValid*(trackDir: Path): bool =
let trackConfigContents = readFile(trackConfigPath)
result = satisfiesSecondPass(trackConfigContents, trackConfigPath)

checkExerciseDirsAreInTrackConfig(trackDir, j, result, trackConfigPath)
if j != nil:
checkExerciseDirsAreInTrackConfig(trackDir, j, result, trackConfigPath)

0 comments on commit 06457bc

Please sign in to comment.