RuboCop: Line is too long ← How to Ignore?

前端 未结 3 2068
孤独总比滥情好
孤独总比滥情好 2021-01-30 15:59

I just added RuboCop to a rails project and installed the Sublime package to see RuboCop suggestions in the editor. I\'m trying to figure out how to change the maximum line leng

3条回答
  •  甜味超标
    2021-01-30 16:23

    Creating a .rubocop.yml file (keep an eye on the initial . in the filename) in the root of your project, you'll have a bunch of options (check comments for what's your Rubocop version used as the way to handle LineLength has changed):

    Metrics/LineLength: # for Rubocop < 0.78.0
    Layout/LineLength: # for Rubocop >= 0.78.0
      # This will disable the rule completely, regardless what other options you put
      Enabled: false
      # Change the default 80 chars limit value
      Max: 120
      # If you want the rule only apply to a specific folder/file
      Include:
        - 'app/**/*'
      # If you want the rule not to apply to a specific folder/file
      Exclude:
        - 'db/schema.rb'
    

提交回复
热议问题