Is there any way to lint a Python file to check for Numpy documentation style adherence? [closed]

久未见 提交于 2019-12-07 01:24:49

问题


I'm working on a project that requires Numpy documentation. In my Java days, I remember having linters that checked for Javadoc adherence in Eclipse/IDEA; is there an equivalent that checks for Numpy documentation style adherence?

I know about PEP257, but it doesn't seem to have any specific checks for Numpy documentation.


回答1:


Pylint seems to support that. Take a look at pylint.extensions.docparams.

To sum it up. You activate this checker of pylint by adding

load-plugins=pylint.extensions.docparams

in the Master section of your .pylintrc.

This checker verifies that all function, method, and constructor docstrings include documentation of the

  • parameters and their types

  • return value and its type

  • exceptions raised


Actually pydocstyle (formerly pep257) recently added support for the numpy docstring convention. Although, it's not perfect I think it's the closest to what you want to achieve and it will probably improve in the near future.

pydocstyle --convention=numpy example.py


来源:https://stackoverflow.com/questions/42123798/is-there-any-way-to-lint-a-python-file-to-check-for-numpy-documentation-style-ad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!