In 2.5.0, the formatter changed how it wraps a short-form (assignment) method definition whose full line exceeds the margin. 2.4.0 wraps the right-hand-side call arguments; 2.5.0 wraps the left-hand-side signature arguments instead. The two outputs are mutually idempotent, so a codebase formatted with one version is reported as unformatted by the other.
This surfaced as a CI break for us: our format check pins JuliaFormatter@2 (floating), so when 2.5.0 was published, format(".") started reporting files across the repo as needing changes even though nothing in the repo had changed. Pinning back to 2.4.0 resolves it.
Minimal reproducer:
.JuliaFormatter.toml
style = "blue"
pipe_to_function_call = false
x.jl
check_constraints(ex::Union{AbstractExpression,AbstractExpressionNode}, options::AbstractOptions)::Bool = check_constraints(ex, options, options.maxsize)
Run using JuliaFormatter; format(".").
2.4.0 (wraps the call on the RHS):
check_constraints(ex::Union{AbstractExpression,AbstractExpressionNode}, options::AbstractOptions)::Bool = check_constraints(
ex, options, options.maxsize
)
2.5.0-2.5.2 (wraps the signature on the LHS):
check_constraints(
ex::Union{AbstractExpression,AbstractExpressionNode}, options::AbstractOptions
)::Bool = check_constraints(ex, options, options.maxsize)
Julia 1.12.6, blue style. 2.4.0 is unaffected; the change first appears in 2.5.0. I tested it on 2.5.2 and it is still there.
Is this an intentional style change? If so, it would help to call it out in the changelog (or have it be opt-in via the config before a v3 is released), since it silently invalidates previously-formatted code whose CI floats on @2.
Many thanks,
Miles
In
2.5.0, the formatter changed how it wraps a short-form (assignment) method definition whose full line exceeds the margin.2.4.0wraps the right-hand-side call arguments;2.5.0wraps the left-hand-side signature arguments instead. The two outputs are mutually idempotent, so a codebase formatted with one version is reported as unformatted by the other.This surfaced as a CI break for us: our format check pins
JuliaFormatter@2(floating), so when2.5.0was published,format(".")started reporting files across the repo as needing changes even though nothing in the repo had changed. Pinning back to2.4.0resolves it.Minimal reproducer:
.JuliaFormatter.tomlx.jlRun
using JuliaFormatter; format(".").2.4.0 (wraps the call on the RHS):
2.5.0-2.5.2 (wraps the signature on the LHS):
Julia 1.12.6,
bluestyle.2.4.0is unaffected; the change first appears in2.5.0. I tested it on2.5.2and it is still there.Is this an intentional style change? If so, it would help to call it out in the changelog (or have it be opt-in via the config before a v3 is released), since it silently invalidates previously-formatted code whose CI floats on
@2.Many thanks,
Miles