自动评论工具 [英] Auto-Commenting Tool

查看:141
本文介绍了自动评论工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近为客户端创建了一个CMS,用于开箱即用。但我在撰写本文时并未 对我的代码进行了评论,因此犯了错误。只是想知道是否有一个工具,将通过CMS的文件,并自动添加注释块。

I recently created a CMS for the client which is meant to work out of the box. But I made a mistake by not commenting my code at the time of writing. Just wanted to know if there is a tool that will go through the files of CMS and add comment blocks automatically.

让我们假设我有这个代码:

Let's suppose I have this code:

class foo{
  function bar(array $array){
    print_r ($array);
  }
}

该工具应该能够像strong> 或有点类似 ):

The tool should be able to comment it like (or somewhat similar):

class foo{

/**
 * bar
 *
 * @access  public
 * @param   array
 * @return  void
 */
 function bar(array $array){
  print_r ($array);
 }

}

strong>

该工具应该只添加phpdoc存根,我会自己写解释性评论。

The tool should only add phpdoc stubs, i will write explanatory comments myself.

推荐答案

虽然我相信有工具可以在签名上反映(在较小程度上 tokenize 方法体),我很确定没有可以插入的工具方法的简短说明。想想,这就是你 - 开发人员描述函数应该做什么的地方。

While I am sure there is tools that can reflect on the signature (and to a lesser extent tokenize the method body), I am pretty sure there is no tool that would be able to insert the short or long description of the method. Think about it, that's where you - the developer - describes what the function is supposed to do.

所以即使有一个工具可以插入存根,你也必须经过每个评论。在这种情况下,您可以使用像Zend Studio,带PDT的Eclipse或Netbeans等IDE来插入注释块。他们将自动打开一个新的注释块时插入存根,所以你需要做的是填写描述。

So even if there is a tool that can insert the stubs, you will have to go through each comment anyway. And in this case, you can just as well use an IDE like Zend Studio, Eclipse with PDT or Netbeans to insert the comment blocks. They will insert the stubs when opening a new comment block automatically, so all you have to do is fill in the description.

这篇关于自动评论工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆