How do I make Mercurial require files to have documentation (Javadoc, etc) before pushing?

208 views Asked by At

Is this something that is currently possible via extension or native functionality?

Thanks,

Brandon

2

There are 2 answers

0
Paul Nathan On BEST ANSWER

You would want a pre-commit hook that would call out to your "validate document" program. Then based on the response to the document validation, you could permit/deny the hook.

1
Deep Kapadia On

Hmm, I forgot about pre-commit hooks.

If you are working in the Java world, you could use tools such as checkstyle to check for Javadocs as a part of your build to enforce coding standards and such which may include having Javadocs for all code.

Documenting code should be each developers responsibility and they should take it to heart. Even with tools such as checkstyle or using a pre-commit hook, you can only enforce some Javadocs being present in the code but not control the quality of the documentation.

If you follow good practices such as adherence to coding standards and solid peer code reviews, it will alleviate the need for you requiring Hg to check for Javadocs before checking code in.

Just my 2c.