Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --check option to fmt #71

Open
rcmachado opened this issue May 29, 2020 · 4 comments
Open

Add --check option to fmt #71

rcmachado opened this issue May 29, 2020 · 4 comments

Comments

@rcmachado
Copy link
Owner

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.

@Pradhvan
Copy link

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

@rcmachado
Copy link
Owner Author

@Pradhvan That's great :D

Feel free to reach out in case you need anything

@Pradhvan
Copy link

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

@rcmachado
Copy link
Owner Author

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants