changelog icon indicating copy to clipboard operation
changelog copied to clipboard

Add --check option to fmt

Open rcmachado opened this issue 4 years ago • 4 comments

The fmt command formats and normalizes the changelog file.

But to check if the file is formatted correctly, we need to run something similar to:

diff -u <(changelog fmt -f CHANGELOG.md) CHANGELOG.md

We can simplify this code to:

changelog fmt --check

Which is useful specially for CI environments.

rcmachado avatar May 29 '20 02:05 rcmachado

@rcmachado I recently started learning Go I can pick this up. 😄

Pradhvan avatar Oct 22 '20 11:10 Pradhvan

@Pradhvan That's great :D

Feel free to reach out in case you need anything

rcmachado avatar Oct 22 '20 13:10 rcmachado

@rcmachado sure. 😄 I am looking into cobra and parser.go at the moment.

Pradhvan avatar Oct 24 '20 08:10 Pradhvan

@Pradhvan That's a good starting point. parser.go uses blackfriday to read the markdown file and a set of custom functions to render it.

The challenge is to make sure things like whitespaces and new lines are also considered - for our use case, extra whitespaces and new lines would cause the --check option to fail. So you'll probably have to take a look and see what's possible on blackfriday.

Obviously, if you have other ideas also feel free to experiment them :)

rcmachado avatar Oct 24 '20 13:10 rcmachado