Report a global error if the changelog could not be found

This commit is contained in:
Jeroen Engels 2023-06-03 01:37:06 +02:00
parent eecf1e4f24
commit b29d9f3fef
2 changed files with 36 additions and 1 deletions

View File

@ -115,4 +115,19 @@ extraFilesVisitor files context =
)
Nothing ->
( [], context )
( [ Rule.globalError
{ message = "Could not find the CHANGELOG.md file"
, details =
[ "I was looking for the CHANGELOG.md file next to your project's elm.json file but couldn't find it. Please make sure that the spelling is correct."
, "If your changelog is named differently or is in a different location, then you can configure this rule to look for it in a different location:"
, """ config =
[ Docs.NoMissingChangelogEntry.defaults
|> Docs.NoMissingChangelogEntry.changelogPath "path/to/your/changelog.md"
|> Docs.NoMissingChangelogEntry.rule
]"""
, "Note that the path is relative your project's elm.json file."
]
}
]
, context
)

View File

@ -59,6 +59,26 @@ a = 1
, details = [ "It seems you have or are ready to release a new version of your package, but forgot to include releases notes for it in your CHANGELOG.md file." ]
}
]
, test "should report an error when the changelog could not be found (default path)" <|
\() ->
"""module A exposing (..)
a = 1
"""
|> Review.Test.runWithProjectData package (rule Docs.NoMissingChangelogEntry.defaults)
|> Review.Test.expectGlobalErrors
[ { message = "Could not find the CHANGELOG.md file"
, details =
[ "I was looking for the CHANGELOG.md file next to your project's elm.json file but couldn't find it. Please make sure that the spelling is correct."
, "If your changelog is named differently or is in a different location, then you can configure this rule to look for it in a different location:"
, """ config =
[ Docs.NoMissingChangelogEntry.defaults
|> Docs.NoMissingChangelogEntry.changelogPath "path/to/your/changelog.md"
|> Docs.NoMissingChangelogEntry.rule
]"""
, "Note that the path is relative your project's elm.json file."
]
}
]
]