JuliaFormatter.jl
JuliaFormatter.jl copied to clipboard
format_docstrings is not idempotent
Another example from https://github.com/jump-dev/JuMP.jl/pull/2993
s = """
\"\"\"
solve_knapsack(
optimizer,
data_filename::String,
config::_AbstractConfiguration,
)
Solve the knapsack problem and return the optimal primal solution
## Arguments
- `optimizer`: an object that can be passed to `JuMP.Model` to construct a new
JuMP model.
- `data_filename`: the filename of a JSON file containing the data for the
problem.
- `config`: an object to control the type of knapsack model constructed.
Valid options are:
+ `BinaryKnapsackConfig()`
+ `IntegerKnapsackConfig()`
## Returns
\"\"\"
foo() = nothing
"""
s1 = JuliaFormatter.format_text(s; format_docstrings = true)
s2 = JuliaFormatter.format_text(s1; format_docstrings = true)
s3 = JuliaFormatter.format_text(s2; format_docstrings = true)
yields
julia> s1 == s2
false
julia> s2 == s3
true
julia> print(s3)
"""
solve_knapsack(
optimizer,
data_filename::String,
config::_AbstractConfiguration,
)
Solve the knapsack problem and return the optimal primal solution
## Arguments
- `optimizer`: an object that can be passed to `JuMP.Model` to construct a new
JuMP model.
- `data_filename`: the filename of a JSON file containing the data for the
problem.
- `config`: an object to control the type of knapsack model constructed.
Valid options are:
+ `BinaryKnapsackConfig()`
+ `IntegerKnapsackConfig()`
## Returns
"""
foo() = nothing
I don't know what should happen, but there probably should be an additional blank line added after the first argument bullet.
so it keeps adding a new blank line on each format then?
No, once it gets to s3
it stops.