Add visitor for the changelog

This commit is contained in:
Jeroen Engels 2023-06-02 17:22:18 +02:00
parent 5322a8a5d1
commit da70f8c64f

View File

@ -49,6 +49,7 @@ rule : Rule
rule =
Rule.newProjectRuleSchema "Docs.NoMissingChangelogEntry" initialProjectContext
|> Rule.withElmJsonProjectVisitor elmJsonVisitor
|> Rule.withExtraFilesProjectVisitor [ "CHANGELOG.md" ] extraFilesVisitor
|> Rule.fromProjectRuleSchema
@ -77,3 +78,14 @@ elmJsonVisitor maybeElmJsonData context =
Nothing ->
( [], context )
extraFilesVisitor : List { path : String, content : String } -> ProjectContext -> ( List (Rule.Error { useErrorForModule : () }), ProjectContext )
extraFilesVisitor files context =
case List.head files of
Just { content } ->
( [], context )
Nothing ->
--( [ Rule.error { useErrorForModule = () } "Missing CHANGELOG.md file" ], context
( [], context )