Skip to content

Commit

Permalink
Introduce a line with links
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Jun 15, 2024
1 parent 1d810a3 commit 3a73de3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
20 changes: 19 additions & 1 deletion src/Docs/NoMissingChangelogEntry.elm
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,25 @@ errorFix : Maybe ( Int, a ) -> Maybe Int -> String -> List Fix.Fix
errorFix unreleased unreleasedLinkLine elmJsonVersion =
case unreleased of
Just ( lineNumber, _ ) ->
[ Fix.insertAt { row = lineNumber + 1, column = 1 } ("\n## [" ++ elmJsonVersion ++ "]\n\n") ]
Fix.insertAt { row = lineNumber + 1, column = 1 } ("\n## [" ++ elmJsonVersion ++ "]\n\n")
:: fixForUnreleasedLinkLine unreleasedLinkLine "author/package" elmJsonVersion

Nothing ->
[]


fixForUnreleasedLinkLine : Maybe Int -> String -> String -> List Fix.Fix
fixForUnreleasedLinkLine unreleasedLinkLine packageName elmJsonVersion =
case unreleasedLinkLine of
Just lineNumber ->
[ Fix.replaceRangeBy
{ start = { row = lineNumber, column = 1 }
, end = { row = lineNumber + 1, column = 1 }
}
(("[Unreleased]: https://github.com/" ++ packageName ++ "/compare/v" ++ elmJsonVersion ++ "...HEAD\n")
++ ("[" ++ elmJsonVersion ++ "]: https://github.com/" ++ packageName ++ "/releases/tag/" ++ elmJsonVersion ++ "\n")
)
]

Nothing ->
[]
Expand Down
14 changes: 7 additions & 7 deletions tests/Docs/NoMissingChangelogEntryTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ More stuff happened
## 1.12.0
Stuff happened
[Unreleased]: https://github.com/jfmengels/elm-review-documentation/compare/v1.13.0...HEAD
[1.13.0]: https://github.com/jfmengels/elm-review-documentation/releases/tag/1.13.0
[1.12.0]: https://github.com/jfmengels/elm-review-documentation/releases/tag/1.12.0
[Unreleased]: https://github.com/author/package/compare/v1.13.0...HEAD
[1.13.0]: https://github.com/author/package/releases/tag/1.13.0
[1.12.0]: https://github.com/author/package/releases/tag/1.12.0
"""
)
]
Expand Down Expand Up @@ -163,10 +163,10 @@ More stuff happened
## 1.12.0
Stuff happened
[Unreleased]: https://github.com/jfmengels/elm-review-documentation/compare/v2.13.0...HEAD
[2.13.0]: https://github.com/jfmengels/elm-review-documentation/releases/tag/2.13.0
[1.13.0]: https://github.com/jfmengels/elm-review-documentation/releases/tag/1.13.0
[1.12.0]: https://github.com/jfmengels/elm-review-documentation/releases/tag/1.12.0
[Unreleased]: https://github.com/author/package/compare/v2.13.0...HEAD
[2.13.0]: https://github.com/author/package/releases/tag/2.13.0
[1.13.0]: https://github.com/author/package/releases/tag/1.13.0
[1.12.0]: https://github.com/author/package/releases/tag/1.12.0
"""
]
)
Expand Down

0 comments on commit 3a73de3

Please sign in to comment.