Reek gem在我的代码中识别出一种气味,因此它缺少类中的文档。 但我想知道是否应该也应用于控制器。
在良好的代码库中,控制器将非常薄,只需处理请求并将所有逻辑委托给模型/服务/帮助程序。 因此,开始记录并不多。 不是API,特别是不是开放的API,我没有看到向它添加文档的充分理由。
想听听你对此的看法。
Reek gem identifies a smell in my code such that it lacks documentation in classes. But I was wondering if that should be applied to controllers as well.
In a good codebase, a controller would be very thin, just dealing with the requests and delegating all the logic to models/services/helpers. Hence not much to document to begin with. Not being an API and especially not an open one, I don't see a good reason to add documentation to it.
Would like to hear your opinion on this.
最满意答案
在我看来,控制器中不需要文档。 但是如果你想让臭味不能识别这种气味,那么你可以添加一个控制器的单线解释或添加
#:nodoc: all在控制器的顶部(这就是我所做的)。 这是由rubycop gem建议的
希望这可以帮助。
In my opinion, there is no need for documentation in controllers. But if you want reek to not identify this smell then you can add a one-liner explanation of the controller or add
#:nodoc: allat the top in your controllers (this is what I do). This is suggested by rubycop gem
Hope this helps.
更多推荐
发布评论