Skip to content

Commit

Permalink
Pin JuliaFormatter to v2 and fix new formatting failures
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHatherly committed Oct 17, 2024
1 parent 9839da3 commit 4ff24ee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .ci/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[deps]
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"

[compat]
JuliaFormatter = "2"
8 changes: 4 additions & 4 deletions src/QuartoNotebookWorker/src/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function _render_thunk(
return ((;
code = "", # an expanded cell that errored can't have returned code
cell_options = Dict{String,Any}(), # or options
results = Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}(),
results = Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}(),

Check warning on line 60 in src/QuartoNotebookWorker/src/render.jl

View check run for this annotation

Codecov / codecov/patch

src/QuartoNotebookWorker/src/render.jl#L60

Added line #L60 was not covered by tests
display_results,
output = captured.output,
error = string(typeof(error)),
Expand Down Expand Up @@ -294,7 +294,7 @@ function clean_bt_str(is_error::Bool, bt, err, prefix = "", mimetype = false)

if mimetype
non_worker = findfirst(x -> contains(String(x.file), @__FILE__), bt)
bt = bt[1:max(something(non_worker, length(bt)) - 3, 0)]
bt = bt[1:max(something(non_worker, length(bt))-3, 0)]

Check warning on line 297 in src/QuartoNotebookWorker/src/render.jl

View check run for this annotation

Codecov / codecov/patch

src/QuartoNotebookWorker/src/render.jl#L297

Added line #L297 was not covered by tests
end

buf = IOBuffer()
Expand Down Expand Up @@ -329,7 +329,7 @@ function render_mimetypes(value, cell_options; inline::Bool = false)
options = NotebookState.OPTIONS[]
to_format = rget(options, ("format", "pandoc", "to"), nothing)

result = Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}()
result = Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}()

Check warning on line 332 in src/QuartoNotebookWorker/src/render.jl

View check run for this annotation

Codecov / codecov/patch

src/QuartoNotebookWorker/src/render.jl#L332

Added line #L332 was not covered by tests
# Some output formats that we want to write to need different
# handling of valid MIME types. Currently `docx` and `typst`. When
# we detect that the `to` format is one of these then we select a
Expand Down Expand Up @@ -417,7 +417,7 @@ function render_mimetypes(value, cell_options; inline::Bool = false)
return result
end
render_mimetypes(value::Nothing, cell_options; inline::Bool = false) =
Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}()
Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}()

Check warning on line 420 in src/QuartoNotebookWorker/src/render.jl

View check run for this annotation

Codecov / codecov/patch

src/QuartoNotebookWorker/src/render.jl#L420

Added line #L420 was not covered by tests


# Our custom MIME types need special handling. They get rendered to
Expand Down
2 changes: 1 addition & 1 deletion src/precompile.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PrecompileTools.@setup_workload begin
notebook = joinpath(@__DIR__, "..", "test", "examples", "cell_types.qmd")
script = joinpath(@__DIR__, "..", "test", "examples", "cell_types.jl")
results = Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}}()
results = Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}}()
PrecompileTools.@compile_workload begin
raw_text_chunks(notebook)
raw_text_chunks(script)
Expand Down
2 changes: 1 addition & 1 deletion src/server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ values. We do here rather than in the worker because we don't want to have to
define additional functions in the worker and import `Base64` there. The worker
just has to provide bytes.
"""
function process_results(dict::Dict{String,@NamedTuple{error::Bool, data::Vector{UInt8}}})
function process_results(dict::Dict{String,@NamedTuple{error::Bool,data::Vector{UInt8}}})
funcs = Dict(
"application/json" => json_reader,
"application/pdf" => Base64.base64encode,
Expand Down

0 comments on commit 4ff24ee

Please sign in to comment.