开始在使用RoboCop解析代码的时候,方法体重多些了几行,浮动波浪线提示出:
Metrics/MethodLength: Method has too many lines. [21/10] (convention:Metrics/MethodLength)
解决办法,修改RuboCop的配置
我的路径C:\Ruby24\lib\ruby\gems\2.4.0\gems\rubocop-0.55.0\config\default.yml
查找Metrics/MethodLength
默认值:
Metrics/MethodLength:
CountComments: false # count full line comments?
Max: 10
按自己需求修改
Metrics/MethodLength:
CountComments: false # count full line comments?
Max: 200