Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code ruby-rubocode increase Metrics/MethodLength check

Rubocode (in VS Code's ruby-rubocode extension) insists that no method should be longer than 10 lines:

Metrics/MethodLength: Method has too many lines. [11/10] (convention:Metrics/MethodLength)

I think that this is a bit severe, and would like to change it to 20.

Is it possible to edit this value via VS Code's settings.json?

Update
B) Is it also possible to increase the Metrics/LineLength from 80 to 120?

Metrics/LineLength: Line is too long. [108/80] (convention:Metrics/LineLength)
like image 942
Roman Avatar asked Oct 14 '25 14:10

Roman


1 Answers

You can edit rubocop config/default.yml to do what you are looking for.

Look at the Metrics section and change Metrics/LineLength and Metrics/MethodLength values.

If you want to change these settings for your current project only then create .rubocop.yml file in the required project directory:

Metrics/LineLength:
  Max: 120
Metrics/MethodLength:
  Max: 20
like image 140
UncleAlex Avatar answered Oct 18 '25 04:10

UncleAlex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!