禁用内联或每个方法 reek 代码气味检测器

disable inline or per method reek code smell detector

有没有办法禁用来自 reek gem 每个方法、每行或每个块的警告?

例如rubocop我们有什么

# suppress warning Use snake_case for method names
def fooBar(baz) # rubocop:disable Naming/MethodName
  baz
end

此示例将抑制 rubocop 的警告,我正在寻找与 reek 工具类似的东西。

def foo(bar) # reek:disable TooManyStatements
  baz = bar + bar
  # other line
  # more line
  # that produce reek warning
  baz
end  

在文档中我发现它只能通过配置文件进行配置,但这不是我要找的

https://github.com/troessner/reek/blob/master/docs/Smell-Suppression.md#how-to-disable-smell-detection

There are always the Basic Smell Options you can use in your configuration file. But in this document we would like to focus on a completely different way - via special comments.

A simple example:

# This method smells of :reek:NestedIterators
def smelly_method(foo)
  foo.each { |bar| bar.each { |baz| baz.qux } }
end

The method smelly_method will not be reported. The general pattern is to put the string :reek:, followed by the smell class, in a comment before the method or class.