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: add initial checks for approaches and articles #704

Merged
merged 13 commits into from
Nov 11, 2022

Commits on Nov 4, 2022

  1. lint: check approaches and articles

    There is not yet a formal spec for an approach `config.json` file or an
    article `config.json` file, but I've tried to implement linting them
    from the docs for approaches [1][2] and a commit [3] on the csharp
    track.
    
    [1] https://github.com/exercism/docs/blob/5509b2f12fac/building/tracks/concept-exercises.md#file-approachesconfigjson
    [2] https://github.com/exercism/docs/blob/5509b2f12fac/building/tracks/practice-exercises.md#file-approachesconfigjson
    [3] exercism/csharp@4069cca97782
    ee7 committed Nov 4, 2022
    Configuration menu
    Copy the full SHA
    d8a8c7d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0e70d2b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d79953b View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2022

  1. lint(approaches_and_articles): error for 8 newlines then non-newline

    Make `configlet lint` produce an error for a snippet with 8 newline
    characters then non-newline content on the 9th line, e.g.:
    
        1\n2\n3\n4\n5\n6\n7\n8\n9
    
    Note that this means we do not count lines like `wc`:
    
        $ printf '1\n2\n3\n4\n5\n6\n7\n8' | wc -l
        7
        $ printf '1\n2\n3\n4\n5\n6\n7\n8\n' | wc -l
        8
        $ printf '1\n2\n3\n4\n5\n6\n7\n8\n9' | wc -l
        8
        $ printf '1\n2\n3\n4\n5\n6\n7\n8\n9\n' | wc -l
        9
    ee7 committed Nov 9, 2022
    Configuration menu
    Copy the full SHA
    6cc4380 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3adba39 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2022

  1. Configuration menu
    Copy the full SHA
    a260510 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6747ce1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c5ee39e View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2022

  1. Configuration menu
    Copy the full SHA
    0300ae6 View commit details
    Browse the repository at this point in the history
  2. lint(approaches_and_articles): error for missing intro/content/snippet

    Try to implement these checks for `.approaches/config.json`
    
    - If the `introduction.authors` array is non-empty, there must be a non-empty `introduction.md` file
    - Any `approaches.slug` value must have a corresponding non-empty `<slug>/content.md` file
    - Any `approaches.slug` value must have a corresponding non-empty `<slug>/snippet.txt` file
    
    And these checks for `.articles/config.json`
    
    - Any `articles.slug` value must have a corresponding non-empty `<slug>/content.md` file
    - Any `articles.slug` value must have a corresponding non-empty `<slug>/snippet.md` file
    
    Some output:
    
        $ configlet lint
        [...]
        The config.json 'introduction' object is present, but there is no corresponding introduction file at the below location:
        ./exercises/practice/bob/.approaches/introduction.md
    
        A config.json 'approaches.slug' value is 'if', but there is no corresponding content file at the below location:
        ./exercises/practice/bob/.approaches/if/content.md
    
        A config.json 'approaches.slug' value is 'answer-array', but there is no corresponding snippet file at the below location:
        ./exercises/practice/bob/.approaches/answer-array/snippet.txt
    
        A config.json 'articles.slug' value is 'performance', but there is no corresponding content file at the below location:
        ./exercises/practice/bob/.articles/performance/content.md
    
        A config.json 'articles.slug' value is 'performance', but there is no corresponding snippet file at the below location:
        ./exercises/practice/bob/.articles/performance/snippet.md
    ee7 committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    fe94cf2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5e710b2 View commit details
    Browse the repository at this point in the history
  4. lint(approaches_and_articles): error for dir not in config slugs

    Example output:
    
        $ configlet lint
        [...]
        There is no 'approaches.slug' key with the value 'performance', but a sibling directory exists with that name:
        ../exercism-tracks/csharp/exercises/practice/reverse-string/.approaches/config.json
    ee7 committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    abe6d59 View commit details
    Browse the repository at this point in the history
  5. lint(approaches_and_articles): fix whitespace

    Appease nimpretty.
    ee7 committed Nov 11, 2022
    Configuration menu
    Copy the full SHA
    fe35e86 View commit details
    Browse the repository at this point in the history