mirror of
https://github.com/jfmengels/elm-review.git
synced 2025-01-08 10:47:25 +03:00
Don't report errors if the version is 1.0.0
This commit is contained in:
parent
20a42e35f8
commit
aa7d289e99
@ -116,6 +116,9 @@ extraFilesVisitor changelogPath files context =
|
||||
Nothing ->
|
||||
( [], context )
|
||||
|
||||
Just "1.0.0" ->
|
||||
( [], context )
|
||||
|
||||
Just elmJsonVersion ->
|
||||
if String.contains elmJsonVersion content then
|
||||
( [], context )
|
||||
@ -130,33 +133,42 @@ extraFilesVisitor changelogPath files context =
|
||||
)
|
||||
|
||||
Nothing ->
|
||||
case changelogPath of
|
||||
case context.elmJsonVersion of
|
||||
Nothing ->
|
||||
( [ 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 =
|
||||
( [], context )
|
||||
|
||||
Just "1.0.0" ->
|
||||
-- TODO Report an error with a changelog skeleton
|
||||
( [], context )
|
||||
|
||||
Just _ ->
|
||||
case changelogPath of
|
||||
Nothing ->
|
||||
( [ 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.withPathToChangelog "path/to/your/changelog.md"
|
||||
|> Docs.NoMissingChangelogEntry.rule
|
||||
]"""
|
||||
, "Note that the path is relative your project's elm.json file."
|
||||
]
|
||||
}
|
||||
]
|
||||
, context
|
||||
)
|
||||
, "Note that the path is relative your project's elm.json file."
|
||||
]
|
||||
}
|
||||
]
|
||||
, context
|
||||
)
|
||||
|
||||
Just customPath ->
|
||||
( [ Rule.globalError
|
||||
{ message = "Could not find the " ++ customPath ++ " changelog file"
|
||||
, details =
|
||||
[ "I was looking for the " ++ customPath ++ " changelog file but couldn't find it. Please make sure that the path you specified through Docs.NoMissingChangelogEntry.withPathToChangelog is correct."
|
||||
, "Also note that the path you specify has to be relative to your project's elm.json file."
|
||||
]
|
||||
}
|
||||
]
|
||||
, context
|
||||
)
|
||||
Just customPath ->
|
||||
( [ Rule.globalError
|
||||
{ message = "Could not find the " ++ customPath ++ " changelog file"
|
||||
, details =
|
||||
[ "I was looking for the " ++ customPath ++ " changelog file but couldn't find it. Please make sure that the path you specified through Docs.NoMissingChangelogEntry.withPathToChangelog is correct."
|
||||
, "Also note that the path you specify has to be relative to your project's elm.json file."
|
||||
]
|
||||
}
|
||||
]
|
||||
, context
|
||||
)
|
||||
|
@ -114,6 +114,30 @@ a = 1
|
||||
, details = [ "This rule only supports Elm packages, but doesn't support Elm applications as they don't have a version number. I recommend that you remove this rule from your review configuration." ]
|
||||
}
|
||||
]
|
||||
, test "should not report an error when the version is 1.0.0 (no changelog)" <|
|
||||
\() ->
|
||||
"""module A exposing (..)
|
||||
a = 1
|
||||
"""
|
||||
|> Review.Test.runWithProjectData (package "1.0.0") (rule defaults)
|
||||
|> Review.Test.expectNoErrors
|
||||
, test "should not report an error when the version is 1.0.0 (empty changelog)" <|
|
||||
\() ->
|
||||
let
|
||||
project : Project
|
||||
project =
|
||||
Project.addExtraFiles
|
||||
[ { path = "CHANGELOG.md"
|
||||
, content = ""
|
||||
}
|
||||
]
|
||||
(package "1.0.0")
|
||||
in
|
||||
"""module A exposing (..)
|
||||
a = 1
|
||||
"""
|
||||
|> Review.Test.runWithProjectData project (rule defaults)
|
||||
|> Review.Test.expectNoErrors
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user