spotless-changelog
spotless-changelog copied to clipboard
Allow the version token to be a link
Hello,
In my project instead of using a simple [1.0.0] - 2021-04-06 we use [1.0.0](#100---2021-04-06) - 2021-04-06 (to quickly focus on the paragraph version and to be more pretty).
But because you only check for "] - " to end the parsing of the version then in my changelogs the changelogCheck is going to always throw the error below:
https://github.com/diffplug/spotless-changelog/blob/3b773c36024815f8dc4c07e753dee8ba482f6a51/spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/Changelog.java#L252-L257
What do you think?
Right now the model is this:
## [x.y.z] - yyyy-mm-dd {optionalHeaderMisc}
In order to work, spotless-changelog needs to parse a changelog and modify it. So to handle your case, we need to:
- add more modes/resilience into the parser (including error messages)
- need to change this method:
https://github.com/diffplug/spotless-changelog/blob/3b773c36024815f8dc4c07e753dee8ba482f6a51/spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/Changelog.java#L286-L295
One of the simple features we have already is that you can replace the versionSchema function. It would also be easy to replace the headerMisc with a specific computed value (link to javadoc, usage stats, etc.)
I think it would reasonable to do something like this:
- add
@Nullable String versionLinkfield toChangelog.VersionEntry - add
interface VersionLink { String compute(String version, String date, @Nullable String headerMisc) }, which is used to specify these links for new entries - figuring out how to / whether to change these links for existing entries is tricky
I would be happy to merge a PR along these lines. However, I insist that the PR author starts by writing the documentation first, and getting a round of feedback on that part. Adding this versionLink feature, imo, is useful but not very useful. So if it doubles the complexity for users who are okay with the standard keepachangelog format, then it's not worth it. The burden on making this flexibility unobtrusive is on the PR author, but I am confident it can be done.
Thank you for your reply.
Now I'm occupied with another project. When I get spare time I'm going to see what I can do.