Inline `rubocop:enforced_style`
Author: AlexWayferCreated Aug 24, 2020Updated Sep 1, 2026
Labelsfeature requeststale
Is your feature request related to a problem? Please describe.
I have hashes in a single file like these:
DEFAULT_PDF_OPTIONS = {
landscape: false,
paper_width: 8.5,
paper_height: 11,
scale: 1.0
}.freeze
PAPEP_FORMATS = {
letter: { width: 8.50, height: 11.00 },
legal: { width: 8.50, height: 14.00 },
tabloid: { width: 11.00, height: 17.00 },
ledger: { width: 17.00, height: 11.00 },
A0: { width: 33.10, height: 46.80 },
A1: { width: 23.40, height: 33.10 },
A2: { width: 16.54, height: 23.40 },
A3: { width: 11.70, height: 16.54 },
A4: { width: 8.27, height: 11.70 },
A5: { width: 5.83, height: 8.27 },
A6: { width: 4.13, height: 5.83 }
}.freezeAnd for the first one I don't want a table style — there are different types of values, but for the second one the table style is better.
Describe the solution you'd like
Something like:
DEFAULT_PDF_OPTIONS = {
landscape: false,
paper_width: 8.5,
paper_height: 11,
scale: 1.0
}.freeze
PAPEP_FORMATS = { # rubocop:enforced_style Layout/HashAlignment, table
letter: { width: 8.50, height: 11.00 },
legal: { width: 8.50, height: 14.00 },
tabloid: { width: 11.00, height: 17.00 },
ledger: { width: 17.00, height: 11.00 },
A0: { width: 33.10, height: 46.80 },
A1: { width: 23.40, height: 33.10 },
A2: { width: 16.54, height: 23.40 },
A3: { width: 11.70, height: 16.54 },
A4: { width: 8.27, height: 11.70 },
A5: { width: 5.83, height: 8.27 },
A6: { width: 4.13, height: 5.83 }
}.freezeDescribe alternatives you've considered
- Rewrite one of hashes to specified style.
# rubocop:disable Layout/HashAlignment.
Source: rubocop/rubocop