如果您在线禁用Rubocop规则并且不重新启用它,那么将对所有子序列文件禁用该规则,还是在线禁用被限制为当前文件的范围?
例如,如果我在一些我知道打破线长规则的方法之前输入此代码:
# rubocop:disable Metrics/LineLength
Run Code Online (Sandbox Code Playgroud)
此规则是否对文件的其余部分或当前扫描中的所有后续文件均禁用?
You can also disable rubocop with a comment following some code, which disables it only for that line. For example:
def update # rubocop:disable Style/EmptyMethod
end
Run Code Online (Sandbox Code Playgroud)
This can be nice if you want to say "yes I know this method has too many lines" or something without needing to remember to turn the cop back on.