RuboCop

RuboCop, the Ruby linter and formatter.

Formats
Ruby
In ur.toml
[format.ruby] style = "rubocop"
Its options
https://docs.rubocop.org/rubocop/configuration.html

Formatted

cart.rb, as written
# What a cart costs.
def subtotal(items)
    items.sum { |item| item.price*item.quantity }
end
def label(item) = item.name+" x"+item.quantity.to_s
ur format --style rubocop cart.rb
# What a cart costs.
def subtotal(items)
  items.sum { |item| item.price * item.quantity }
end

def label(item) = item.name + " x" + item.quantity.to_s

Try it in the playground →

Defaults

The shared options, as RuboCop sets them when nothing configures it. Its own names for them are read from its configuration files, but ur.toml sets them by the shared name only.

OptionDefaultRuboCop calls it
width120Layout/LineLength.Max
indent.width2Layout/IndentationWidth.Width
indent.styleLayout/IndentationStyle.EnforcedStyle
line-ending"auto"
trailing-comma.add"preserve"
trailing-comma.forces-breakfalse
quotes"preserve"
targetAllCops.TargetRubyVersion

Its own options

Set in a table named for it, such as [format.rubocop], or in a language's table, as rubocop = { ... }.

OptionDefaultValues
AllCops.EnabledByDefaultfalsetrue or false
AllCops.DisabledByDefaultfalsetrue or false
AllCops.NewCops"pending"a string
AllCops.ParserEngine"default"a string
AllCops.ActiveSupportExtensionsEnabledfalsetrue or false
AllCops.StringLiteralsFrozenByDefaultany value
Layout/AccessModifierIndentation.Enabledtrueany value
Layout/AccessModifierIndentation.EnforcedStyle"indent"a string
Layout/AccessModifierIndentation.IndentationWidthany value
Layout/ArgumentAlignment.Enabledtrueany value
Layout/ArgumentAlignment.EnforcedStyle"with_first_argument"a string
Layout/ArgumentAlignment.IndentationWidthany value
Layout/ArrayAlignment.Enabledtrueany value
Layout/ArrayAlignment.EnforcedStyle"with_first_element"a string
Layout/ArrayAlignment.IndentationWidthany value
Layout/AssignmentIndentation.Enabledtrueany value
Layout/AssignmentIndentation.IndentationWidthany value
Layout/BeginEndAlignment.Enabledtrueany value
Layout/BeginEndAlignment.EnforcedStyleAlignWith"start_of_line"a string
Layout/BlockAlignment.Enabledtrueany value
Layout/BlockAlignment.EnforcedStyleAlignWith"either"a string
Layout/BlockEndNewline.Enabledtrueany value
Layout/CaseIndentation.Enabledtrueany value
Layout/CaseIndentation.EnforcedStyle"case"a string
Layout/CaseIndentation.IndentOneStepfalsetrue or false
Layout/CaseIndentation.IndentationWidthany value
Layout/ClassStructure.Enabledfalseany value
Layout/ClassStructure.Categories{"module_inclusion":["include","prepend","extend"]}any value
Layout/ClassStructure.ExpectedOrder["module_inclusion","constants","public_class_methods","initializer","public_methods","protected_methods","private_class_methods","private_methods"]any value
Layout/ClosingHeredocIndentation.Enabledtrueany value
Layout/ClosingParenthesisIndentation.Enabledtrueany value
Layout/ClosingParenthesisIndentation.IndentationWidthany value
Layout/CommentIndentation.Enabledtrueany value
Layout/CommentIndentation.AllowForAlignmentfalsetrue or false
Layout/CommentIndentation.IndentationWidthany value
Layout/ConditionPosition.Enabledtrueany value
Layout/DefEndAlignment.Enabledtrueany value
Layout/DefEndAlignment.EnforcedStyleAlignWith"start_of_line"a string
Layout/DotPosition.Enabledtrueany value
Layout/DotPosition.EnforcedStyle"leading"a string
Layout/ElseAlignment.Enabledtrueany value
Layout/EmptyComment.Enabledtrueany value
Layout/EmptyComment.AutoCorrect"contextual"a string
Layout/EmptyComment.AllowBorderCommenttruetrue or false
Layout/EmptyComment.AllowMarginCommenttruetrue or false
Layout/EmptyLineAfterGuardClause.Enabledtrueany value
Layout/EmptyLineAfterMagicComment.Enabledtrueany value
Layout/EmptyLineAfterMagicComment.NumberOfEmptyLines1a number
Layout/EmptyLineAfterMultilineCondition.Enabledfalseany value
Layout/EmptyLineBetweenDefs.Enabledtrueany value
Layout/EmptyLineBetweenDefs.EmptyLineBetweenMethodDefstruetrue or false
Layout/EmptyLineBetweenDefs.EmptyLineBetweenClassDefstruetrue or false
Layout/EmptyLineBetweenDefs.EmptyLineBetweenModuleDefstruetrue or false
Layout/EmptyLineBetweenDefs.DefLikeMacros[]any value
Layout/EmptyLineBetweenDefs.AllowAdjacentOneLineDefstruetrue or false
Layout/EmptyLineBetweenDefs.NumberOfEmptyLines1a number
Layout/EmptyLines.Enabledtrueany value
Layout/EmptyLinesAfterModuleInclusion.Enabled"pending"any value
Layout/EmptyLinesAroundAccessModifier.Enabledtrueany value
Layout/EmptyLinesAroundAccessModifier.EnforcedStyle"around"a string
Layout/EmptyLinesAroundArguments.Enabledtrueany value
Layout/EmptyLinesAroundAttributeAccessor.Enabledtrueany value
Layout/EmptyLinesAroundAttributeAccessor.AllowAliasSyntaxtruetrue or false
Layout/EmptyLinesAroundAttributeAccessor.AllowedMethods["alias_method","public","protected","private"]any value
Layout/EmptyLinesAroundBeginBody.Enabledtrueany value
Layout/EmptyLinesAroundBlockBody.Enabledtrueany value
Layout/EmptyLinesAroundBlockBody.EnforcedStyle"no_empty_lines"a string
Layout/EmptyLinesAroundClassBody.Enabledtrueany value
Layout/EmptyLinesAroundClassBody.EnforcedStyle"no_empty_lines"a string
Layout/EmptyLinesAroundExceptionHandlingKeywords.Enabledtrueany value
Layout/EmptyLinesAroundMethodBody.Enabledtrueany value
Layout/EmptyLinesAroundModuleBody.Enabledtrueany value
Layout/EmptyLinesAroundModuleBody.EnforcedStyle"no_empty_lines"a string
Layout/EndAlignment.Enabledtrueany value
Layout/EndAlignment.EnforcedStyleAlignWith"keyword"a string
Layout/EndOfLine.Enabledtrueany value
Layout/EndOfLine.EnforcedStyle"native"a string
Layout/ExtraSpacing.Enabledtrueany value
Layout/ExtraSpacing.AllowForAlignmenttruetrue or false
Layout/ExtraSpacing.AllowBeforeTrailingCommentsfalsetrue or false
Layout/ExtraSpacing.ForceEqualSignAlignmentfalsetrue or false
Layout/FirstArgumentIndentation.Enabledtrueany value
Layout/FirstArgumentIndentation.EnforcedStyle"special_for_inner_method_call_in_parentheses"a string
Layout/FirstArgumentIndentation.IndentationWidthany value
Layout/FirstArrayElementIndentation.Enabledtrueany value
Layout/FirstArrayElementIndentation.EnforcedStyle"special_inside_parentheses"a string
Layout/FirstArrayElementIndentation.IndentationWidthany value
Layout/FirstArrayElementLineBreak.Enabledfalseany value
Layout/FirstArrayElementLineBreak.AllowImplicitArrayLiteralsfalsetrue or false
Layout/FirstArrayElementLineBreak.AllowMultilineFinalElementfalsetrue or false
Layout/FirstHashElementIndentation.Enabledtrueany value
Layout/FirstHashElementIndentation.EnforcedStyle"special_inside_parentheses"a string
Layout/FirstHashElementIndentation.IndentationWidthany value
Layout/FirstHashElementLineBreak.Enabledfalseany value
Layout/FirstHashElementLineBreak.AllowMultilineFinalElementfalsetrue or false
Layout/FirstMethodArgumentLineBreak.Enabledfalseany value
Layout/FirstMethodArgumentLineBreak.AllowMultilineFinalElementfalsetrue or false
Layout/FirstMethodArgumentLineBreak.AllowedMethods[]any value
Layout/FirstMethodParameterLineBreak.Enabledfalseany value
Layout/FirstMethodParameterLineBreak.AllowMultilineFinalElementfalsetrue or false
Layout/FirstParameterIndentation.Enabledtrueany value
Layout/FirstParameterIndentation.EnforcedStyle"consistent"a string
Layout/FirstParameterIndentation.IndentationWidthany value
Layout/HashAlignment.Enabledtrueany value
Layout/HashAlignment.AllowMultipleStylestruetrue or false
Layout/HashAlignment.EnforcedHashRocketStyle"key"a string
Layout/HashAlignment.EnforcedColonStyle"key"a string
Layout/HashAlignment.EnforcedLastArgumentHashStyle"always_inspect"a string
Layout/HeredocArgumentClosingParenthesis.Enabledfalseany value
Layout/HeredocIndentation.Enabledtrueany value
Layout/IndentationConsistency.Enabledtrueany value
Layout/IndentationConsistency.EnforcedStyle"normal"a string
Layout/IndentationStyle.Enabledtrueany value
Layout/IndentationStyle.IndentationWidthany value
Layout/IndentationStyle.EnforcedStyle"spaces"a string
Layout/IndentationWidth.Enabledtrueany value
Layout/IndentationWidth.Width2a number
Layout/IndentationWidth.EnforcedStyleAlignWith"start_of_line"a string
Layout/IndentationWidth.AllowedPatterns[]any value
Layout/InitialIndentation.Enabledtrueany value
Layout/LeadingCommentSpace.Enabledtrueany value
Layout/LeadingCommentSpace.AllowDoxygenCommentStylefalsetrue or false
Layout/LeadingCommentSpace.AllowGemfileRubyCommentfalsetrue or false
Layout/LeadingCommentSpace.AllowRBSInlineAnnotationfalsetrue or false
Layout/LeadingCommentSpace.AllowSteepAnnotationfalsetrue or false
Layout/LeadingCommentSpace.AllowYARDCommentBlockSeparatorfalsetrue or false
Layout/LeadingEmptyLines.Enabledtrueany value
Layout/LineContinuationLeadingSpace.Enabled"pending"any value
Layout/LineContinuationLeadingSpace.EnforcedStyle"trailing"a string
Layout/LineContinuationSpacing.Enabled"pending"any value
Layout/LineContinuationSpacing.EnforcedStyle"space"a string
Layout/LineEndStringConcatenationIndentation.Enabled"pending"any value
Layout/LineEndStringConcatenationIndentation.EnforcedStyle"aligned"a string
Layout/LineEndStringConcatenationIndentation.IndentationWidthany value
Layout/LineLength.Enabledtrueany value
Layout/LineLength.Max120a number
Layout/LineLength.AllowHeredoctruetrue or false
Layout/LineLength.AllowURItruetrue or false
Layout/LineLength.AllowQualifiedNametruetrue or false
Layout/LineLength.URISchemes["http","https"]any value
Layout/LineLength.AllowRBSInlineAnnotationfalsetrue or false
Layout/LineLength.AllowCopDirectivestruetrue or false
Layout/LineLength.AllowedPatterns[]any value
Layout/LineLength.SplitStringsfalsetrue or false
Layout/MultilineArrayBraceLayout.Enabledtrueany value
Layout/MultilineArrayBraceLayout.EnforcedStyle"symmetrical"a string
Layout/MultilineArrayLineBreaks.Enabledfalseany value
Layout/MultilineArrayLineBreaks.AllowMultilineFinalElementfalsetrue or false
Layout/MultilineAssignmentLayout.Enabledfalseany value
Layout/MultilineAssignmentLayout.EnforcedStyle"new_line"a string
Layout/MultilineBlockLayout.Enabledtrueany value
Layout/MultilineHashBraceLayout.Enabledtrueany value
Layout/MultilineHashBraceLayout.EnforcedStyle"symmetrical"a string
Layout/MultilineHashKeyLineBreaks.Enabledfalseany value
Layout/MultilineHashKeyLineBreaks.AllowMultilineFinalElementfalsetrue or false
Layout/MultilineMethodArgumentLineBreaks.Enabledfalseany value
Layout/MultilineMethodArgumentLineBreaks.AllowMultilineFinalElementfalsetrue or false
Layout/MultilineMethodCallBraceLayout.Enabledtrueany value
Layout/MultilineMethodCallBraceLayout.EnforcedStyle"symmetrical"a string
Layout/MultilineMethodCallIndentation.Enabledtrueany value
Layout/MultilineMethodCallIndentation.EnforcedStyle"aligned"a string
Layout/MultilineMethodCallIndentation.IndentationWidthany value
Layout/MultilineMethodDefinitionBraceLayout.Enabledtrueany value
Layout/MultilineMethodDefinitionBraceLayout.EnforcedStyle"symmetrical"a string
Layout/MultilineMethodParameterLineBreaks.Enabledfalseany value
Layout/MultilineMethodParameterLineBreaks.AllowMultilineFinalElementfalsetrue or false
Layout/MultilineOperationIndentation.Enabledtrueany value
Layout/MultilineOperationIndentation.EnforcedStyle"aligned"a string
Layout/MultilineOperationIndentation.IndentationWidthany value
Layout/ParameterAlignment.Enabledtrueany value
Layout/ParameterAlignment.EnforcedStyle"with_first_parameter"a string
Layout/ParameterAlignment.IndentationWidthany value
Layout/RedundantLineBreak.Enabledfalseany value
Layout/RedundantLineBreak.InspectBlocksfalsetrue or false
Layout/RescueEnsureAlignment.Enabledtrueany value
Layout/SingleLineBlockChain.Enabledfalseany value
Layout/SpaceAfterColon.Enabledtrueany value
Layout/SpaceAfterComma.Enabledtrueany value
Layout/SpaceAfterMethodName.Enabledtrueany value
Layout/SpaceAfterNot.Enabledtrueany value
Layout/SpaceAfterSemicolon.Enabledtrueany value
Layout/SpaceAroundBlockParameters.Enabledtrueany value
Layout/SpaceAroundBlockParameters.EnforcedStyleInsidePipes"no_space"a string
Layout/SpaceAroundEqualsInParameterDefault.Enabledtrueany value
Layout/SpaceAroundEqualsInParameterDefault.EnforcedStyle"space"a string
Layout/SpaceAroundKeyword.Enabledtrueany value
Layout/SpaceAroundMethodCallOperator.Enabledtrueany value
Layout/SpaceAroundOperators.Enabledtrueany value
Layout/SpaceAroundOperators.AllowForAlignmenttruetrue or false
Layout/SpaceAroundOperators.EnforcedStyleForExponentOperator"no_space"a string
Layout/SpaceAroundOperators.EnforcedStyleForRationalLiterals"no_space"a string
Layout/SpaceBeforeBlockBraces.Enabledtrueany value
Layout/SpaceBeforeBlockBraces.EnforcedStyle"space"a string
Layout/SpaceBeforeBlockBraces.EnforcedStyleForEmptyBraces"space"a string
Layout/SpaceBeforeBrackets.Enabled"pending"any value
Layout/SpaceBeforeComma.Enabledtrueany value
Layout/SpaceBeforeComment.Enabledtrueany value
Layout/SpaceBeforeFirstArg.Enabledtrueany value
Layout/SpaceBeforeFirstArg.AllowForAlignmenttruetrue or false
Layout/SpaceBeforeSemicolon.Enabledtrueany value
Layout/SpaceInLambdaLiteral.Enabledtrueany value
Layout/SpaceInLambdaLiteral.EnforcedStyle"require_no_space"a string
Layout/SpaceInsideArrayLiteralBrackets.Enabledtrueany value
Layout/SpaceInsideArrayLiteralBrackets.EnforcedStyle"no_space"a string
Layout/SpaceInsideArrayLiteralBrackets.EnforcedStyleForEmptyBrackets"no_space"a string
Layout/SpaceInsideArrayPercentLiteral.Enabledtrueany value
Layout/SpaceInsideBlockBraces.Enabledtrueany value
Layout/SpaceInsideBlockBraces.EnforcedStyle"space"a string
Layout/SpaceInsideBlockBraces.EnforcedStyleForEmptyBraces"no_space"a string
Layout/SpaceInsideBlockBraces.SpaceBeforeBlockParameterstruetrue or false
Layout/SpaceInsideHashLiteralBraces.Enabledtrueany value
Layout/SpaceInsideHashLiteralBraces.EnforcedStyle"space"a string
Layout/SpaceInsideHashLiteralBraces.EnforcedStyleForEmptyBraces"no_space"a string
Layout/SpaceInsideParens.Enabledtrueany value
Layout/SpaceInsideParens.EnforcedStyle"no_space"a string
Layout/SpaceInsidePercentLiteralDelimiters.Enabledtrueany value
Layout/SpaceInsideRangeLiteral.Enabledtrueany value
Layout/SpaceInsideReferenceBrackets.Enabledtrueany value
Layout/SpaceInsideReferenceBrackets.EnforcedStyle"no_space"a string
Layout/SpaceInsideReferenceBrackets.EnforcedStyleForEmptyBrackets"no_space"a string
Layout/SpaceInsideStringInterpolation.Enabledtrueany value
Layout/SpaceInsideStringInterpolation.EnforcedStyle"no_space"a string
Layout/TrailingEmptyLines.Enabledtrueany value
Layout/TrailingEmptyLines.EnforcedStyle"final_newline"a string
Layout/TrailingWhitespace.Enabledtrueany value
Layout/TrailingWhitespace.AllowInHeredocfalsetrue or false