Python 在doxygen中记录if语句
如何在doxygen中记录if语句,它记录了我的所有类、函数,但我为if语句编写的注释,它考虑了下一个最近的变量Python 在doxygen中记录if语句,python,documentation,doxygen,Python,Documentation,Doxygen,如何在doxygen中记录if语句,它记录了我的所有类、函数,但我为if语句编写的注释,它考虑了下一个最近的变量 if abc != "": # Here we check if abc is not equal to null and then check if it is equal to some known values if abc != "red": if abc != "blue": error() if gfh != ""
if abc != "": # Here we check if abc is not equal to null and then check if it is equal to some known values
if abc != "red":
if abc != "blue":
error()
if gfh != ""
ghf = 0
它将注释分配给“ghf=0”,任何关于如何将注释分配给if语句的想法。Doxygen是生成API文档的工具。也就是说,关于功能和用法的文档将客户机代码的编写者作为目标受众。这些当然不关心实现细节 您似乎要做的是为代码的维护者添加文档。这是另一回事,Doxygen没有解决这一问题 除了一些代码可读性的一般经验法则外,我不知道是否有工具可以帮助您记录控制流:
- 避免“意大利面代码”
- 为变量/函数指定有意义的名称
- 编写有意义的文档字符串
# you don't even need a comment to find out what the intention is here
if is_invalid(abc):
error()
另外,请看一看,也许还有一些东西值得一看。那么您推荐我使用哪种工具?@Ashok我想说,您基本上不需要工具来实现这一点,只要您在编写代码时注重可读性。请查看我的更新以获得一些提示。谢谢您的详细解释!帮了大忙