Skip to content

Layout/LineLength: Allow long fully-qualified namespace strings to exceed max length #14128

@chris-hewitt

Description

@chris-hewitt

Is your feature request related to a problem? Please describe.

There's no clear way to divide a long namespace in the middle, if it exceeds max line length:

def foo
  # invoke the normal migration method
  # in oracle envs this should end up calling ActiveRecord::ConnectionAdapters::OracleEnhanced::SchemaStatements::create_table
  yada_yada
end
my_file.rb:3:121: C: Layout/LineLength: Line is too long. [126/120] (https://rubystyle.guide#max-line-length)

Describe the solution you'd like

I propose a new configurable attribute for Layout/LineLength, for example AllowNamespace, to allow a fully-qualified method/module/class namespace to extend past the max line length without triggering an offense. It would work exactly like AllowURI.

Describe alternatives you've considered

The best alternative would probably be to live with it. Long namespaces are not common, and you could split it at a :: without much grief.

Additional context

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestgood first issueEasy task, suitable for newcomers to the projectstaleIssues that haven't been active in a while

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions