Skip to content

Rubocop AddLimitToTextColumns rule is incomplete

We have a Rubocop rule AddLimitToTextColumns which requires text columns to define a limit in the migration. However, our database guidelines describe three different scenarios when adding a text limit:

  • Create table with text column
  • Existing table with new text column
  • Existing table with existing text column

The Rubocop rule only seems to be valid for case 1 when we create a table. In the two other cases the rule needs to be disabled.

Ideally we need a mechanism that can handle this kind of case. Does one exist?


The following discussion from !97978 (merged) should be addressed:

  • @rob.hunt started a discussion: (+5 comments)

    question (non-blocking): Seeing rubocop being disabled worries me 😅. Could you explain why this is an okay thing to do? 🙏

Edited by Alex Pooley