From c980765b66ca6b583c2696271f6499dd9376c505 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 15:31:18 +0100 Subject: [PATCH 01/14] Update more links to point to organisation --- README.md | 2 +- docs/make.jl | 2 +- docs/src/custom_alignment.md | 2 +- docs/src/integrations.md | 8 ++++---- docs/src/style.md | 2 +- docs/src/transforms.md | 10 +++++----- src/fst.jl | 2 +- src/print.jl | 2 +- src/styles/blue/pretty.jl | 2 +- src/styles/yas/nest.jl | 2 +- src/styles/yas/pretty.jl | 2 +- test/default_style.jl | 16 ++++++++-------- test/files/noformat2.jl | 12 ++++++------ test/options.jl | 2 +- test/sciml_style.jl | 2 +- test/yas_style.jl | 2 +- 16 files changed, 35 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 798e39914..c8667d9f5 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ julia> format_file("foo.jl") julia> format_text(str) ``` -Check out [the docs](https://domluna.github.io/JuliaFormatter.jl/stable/) for further description of the formatter and its options. +Check out [the docs](https://juliaeditorsupport.github.io/JuliaFormatter.jl/stable/) for further description of the formatter and its options. ## Command Line Tool diff --git a/docs/make.jl b/docs/make.jl index d49b410f5..4b42c84bc 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -21,4 +21,4 @@ makedocs(; warnonly = true, ) -deploydocs(; repo = "github.com/domluna/JuliaFormatter.jl.git", push_preview = true) +deploydocs(; repo = "github.com/JuliaEditorSupport/JuliaFormatter.jl.git", push_preview = true) diff --git a/docs/src/custom_alignment.md b/docs/src/custom_alignment.md index 97e13e474..f30e48ee6 100644 --- a/docs/src/custom_alignment.md +++ b/docs/src/custom_alignment.md @@ -1,6 +1,6 @@ # Custom Alignment -> Solution for [issue 179](https://github.com/domluna/JuliaFormatter.jl/issues/179) +> Solution for [issue 179](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/179) Custom alignment is determined by a whitespace heuristic: diff --git a/docs/src/integrations.md b/docs/src/integrations.md index 190f7d99c..b4c8db06c 100644 --- a/docs/src/integrations.md +++ b/docs/src/integrations.md @@ -4,14 +4,14 @@ To learn more about `pre-commit`, [check out their docs](https://pre-commit.com). -With [Pull 674](https://github.com/domluna/JuliaFormatter.jl/pull/674), support for +With [Pull 674](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/pull/674), support for `pre-commit` was added. To add `JuliaFormatter.jl` to your own `pre-commit` workflow, add the following to your `.pre-commit-config.yaml`. ```yaml repos: # ... other repos you may have -- repo: "https://github.com/domluna/JuliaFormatter.jl" +- repo: "https://github.com/JuliaEditorSupport/JuliaFormatter.jl" rev: "v1.0.18" # or whatever the desired release is hooks: - id: "julia-formatter" @@ -24,6 +24,6 @@ Note that it requires the `jlfmt` Pkg app to be installed with pkg> app add JuliaFormatter ``` -You can find a list of releases [here](https://github.com/domluna/JuliaFormatter.jl/releases). +You can find a list of releases [here](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/releases). **Be sure to use the entire version string!** (You can double-check this by opening the -release and looking at the part of the URL that follows `.../releases/tag/VERSION`.) \ No newline at end of file +release and looking at the part of the URL that follows `.../releases/tag/VERSION`.) diff --git a/docs/src/style.md b/docs/src/style.md index 5114bfdac..215aa182f 100644 --- a/docs/src/style.md +++ b/docs/src/style.md @@ -5,7 +5,7 @@ CurrentModule = JuliaFormatter # Style This is meant to give an impression of how the output of a formatted file looks like. -Additional examples can be found in the [test files](https://github.com/domluna/JuliaFormatter.jl/tree/master/test/files). +Additional examples can be found in the [test files](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/tree/master/test/files). ## Initial `FST` diff --git a/docs/src/transforms.md b/docs/src/transforms.md index 88e0dede8..fcab185ae 100644 --- a/docs/src/transforms.md +++ b/docs/src/transforms.md @@ -2,7 +2,7 @@ ## `for in` vs. `for =` -By default if the RHS is a range, i.e. `1:10` then `for in` is converted to `for =`. Otherwise `for =` is converted to `for in`. See [this issue](https://github.com/domluna/JuliaFormatter.jl/issues/34) for the rationale and further explanation. +By default if the RHS is a range, i.e. `1:10` then `for in` is converted to `for =`. Otherwise `for =` is converted to `for in`. See [this issue](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/34) for the rationale and further explanation. Alternative to the above - setting `always_for_in` to `true`, i.e. `format_text(..., always_for_in = true)` will always convert `=` to `in` even if the RHS is a range. `always_for_in=nothing` will leave the choice of `in` vs `=` up to the user. @@ -23,7 +23,7 @@ func( ) ``` -See [this issue](https://github.com/domluna/JuliaFormatter.jl/issues/44) for more details. +See [this issue](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/44) for more details. ## Trailing Semicolons @@ -40,7 +40,7 @@ A = [ ] ``` -See [this issue](https://github.com/domluna/JuliaFormatter.jl/issues/77) for more details. +See [this issue](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/77) for more details. ## Leading and trailing 0s for float literals @@ -74,7 +74,7 @@ a = 1f0 a = 1.0f0 ``` -See [this issue](https://github.com/domluna/JuliaFormatter.jl/issues/66) for more details. +See [this issue](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/66) for more details. ## Surround `where` arguments with curly brackets @@ -88,7 +88,7 @@ foo(x::T) where T = ... foo(x::T) where {T} = ... ``` -See [this issue](https://github.com/domluna/JuliaFormatter.jl/issues/53) for more details. +See [this issue](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/53) for more details. ## Annotate unannotated type fields with `Any` diff --git a/src/fst.jl b/src/fst.jl index 7bfd6120e..ea025e75e 100644 --- a/src/fst.jl +++ b/src/fst.jl @@ -784,7 +784,7 @@ for i = 1:10 body end `always_for_in=nothing` disables this normalization behavior. -- +- """ function eq_to_in_normalization!(fst::FST, always_for_in::Bool, for_in_replacement::String) if fst.typ === Binary diff --git a/src/print.jl b/src/print.jl index 0e0775ab0..cbbe6b083 100644 --- a/src/print.jl +++ b/src/print.jl @@ -227,7 +227,7 @@ function print_inlinecomment(io::IOBuffer, fst::FST, s::State) if ws > 0 write(io, repeat(" ", ws)) elseif startswith(v, "#=") && endswith(v, "=#") - # hack to overcome the bug noticed in https://github.com/domluna/JuliaFormatter.jl/issues/571#issuecomment-1114446297 + # hack to overcome the bug noticed in https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/571#issuecomment-1114446297 # until multiline comments aren't moved to the end of the line. write(io, " ") end diff --git a/src/styles/blue/pretty.jl b/src/styles/blue/pretty.jl index caf5cf869..0c3f1a6be 100644 --- a/src/styles/blue/pretty.jl +++ b/src/styles/blue/pretty.jl @@ -49,7 +49,7 @@ end BlueStyle() Formatting style based on [BlueStyle](https://github.com/invenia/BlueStyle) -and [JuliaFormatter#283](https://github.com/domluna/JuliaFormatter.jl/issues/283). +and [JuliaFormatter#283](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/283). !!! note This style is still work-in-progress, and does not yet implement all of the diff --git a/src/styles/yas/nest.jl b/src/styles/yas/nest.jl index 0febaa75e..ba41ff863 100644 --- a/src/styles/yas/nest.jl +++ b/src/styles/yas/nest.jl @@ -46,7 +46,7 @@ function n_call!( # The indent is set here to handle the edge # case where the first argument of Call is # nestable. - # ref https://github.com/domluna/JuliaFormatter.jl/issues/387 + # ref https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/387 fst.indent = s.line_offset + 1 end diff --git a/src/styles/yas/pretty.jl b/src/styles/yas/pretty.jl index 622dff4ce..dddd3c5e9 100644 --- a/src/styles/yas/pretty.jl +++ b/src/styles/yas/pretty.jl @@ -45,7 +45,7 @@ end YASStyle() Formatting style based on [YASGuide](https://github.com/jrevels/YASGuide) -and [JuliaFormatter#198](https://github.com/domluna/JuliaFormatter.jl/issues/198). +and [JuliaFormatter#198](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/198). Configurable options with different defaults to [`DefaultStyle`](@ref) are: $(list_different_defaults(YASStyle())) diff --git a/test/default_style.jl b/test/default_style.jl index 825338465..5e7f619eb 100644 --- a/test/default_style.jl +++ b/test/default_style.jl @@ -1436,7 +1436,7 @@ begin throw(ErrorException(\"""An error occured formatting \$filename. :-( - Please file an issue at https://github.com/domluna/JuliaFormatter.jl/issues + Please file an issue at https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues with a link to a gist containing the contents of the file. A gist can be created at https://gist.github.com/.\""")) end @@ -1446,7 +1446,7 @@ begin throw(ErrorException(\"""An error occured formatting \$filename. :-( - Please file an issue at https://github.com/domluna/JuliaFormatter.jl/issues + Please file an issue at https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues with a link to a gist containing the contents of the file. A gist can be created at https://gist.github.com/.\""")) end @@ -1460,7 +1460,7 @@ ErrorException( \"""An error occured formatting $filename. :-( - Please file an issue at https://github.com/domluna/JuliaFormatter.jl/issues + Please file an issue at https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues with a link to a gist containing the contents of the file. A gist can be created at https://gist.github.com/.\""", ), @@ -2727,7 +2727,7 @@ @test fmt(str_) == str_ @test fmt(str_, 2, 1) == str - # https://github.com/domluna/JuliaFormatter.jl/issues/9#issuecomment-481607068 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/9#issuecomment-481607068 str = """ this_is_a_long_variable_name = Dict{Symbol,Any}( :numberofpointattributes => NAttributes, @@ -2902,7 +2902,7 @@ arg3""" @test fmt(str_, 4, 19) == str - # https://github.com/domluna/JuliaFormatter.jl/issues/60 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/60 str_ = """ function write_subproblem_to_file( node::Node, filename::String; @@ -2955,7 +2955,7 @@ end""" @test fmt(str, 4, 1) == str - # https://github.com/domluna/JuliaFormatter.jl/issues/453 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/453 str = """ bar = Dict( :foo => \"""A triple quoted literal string @@ -3126,7 +3126,7 @@ _, s = run_nest(str, 73) @test s.line_offset == 9 - # https://github.com/domluna/JuliaFormatter.jl/issues/9#issuecomment-481607068 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/9#issuecomment-481607068 str = """this_is_a_long_variable_name = Dict{Symbol,Any}(:numberofpointattributes => NAttributes, :numberofpointmtrs => NMTr, :numberofcorners => NSimplex, :firstnumber => Cint(1), :mesh_dim => Cint(3),)""" @@ -3497,7 +3497,7 @@ """) == "0.1 + 0.2\n" end - # https://github.com/domluna/JuliaFormatter.jl/issues/77 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/77 @testset "matrices" begin str_ = """ [ a b expr() diff --git a/test/files/noformat2.jl b/test/files/noformat2.jl index fce70f8df..fd1ec088a 100644 --- a/test/files/noformat2.jl +++ b/test/files/noformat2.jl @@ -1266,7 +1266,7 @@ end begin throw(ErrorException(\"""An error occured formatting \$filename. :-( - Please file an issue at https://github.com/domluna/JuliaFormatter.jl/issues + Please file an issue at https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues with a link to a gist containing the contents of the file. A gist can be created at https://gist.github.com/.\""")) end @@ -1276,7 +1276,7 @@ end begin throw(ErrorException(\"""An error occured formatting \$filename. :-( - Please file an issue at https://github.com/domluna/JuliaFormatter.jl/issues + Please file an issue at https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues with a link to a gist containing the contents of the file. A gist can be created at https://gist.github.com/.\""")) end @@ -2206,7 +2206,7 @@ end end""" @test fmt(str_, 4, 24) == str - # https://github.com/domluna/JuliaFormatter.jl/issues/9#issuecomment-481607068 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/9#issuecomment-481607068 str = """ this_is_a_long_variable_name = Dict{Symbol,Any}( :numberofpointattributes => NAttributes, @@ -2345,7 +2345,7 @@ end @test fmt(str_, 4, 7) == str @test fmt(str_, 4, 1) == str - # https://github.com/domluna/JuliaFormatter.jl/issues/60 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/60 str_ = """ function write_subproblem_to_file( node::Node, filename::String; @@ -2547,7 +2547,7 @@ end s = run_nest(str, length(str) - 1) @test s.line_offset == 12 - # https://github.com/domluna/JuliaFormatter.jl/issues/9#issuecomment-481607068 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/9#issuecomment-481607068 str = """this_is_a_long_variable_name = Dict{Symbol,Any}(:numberofpointattributes => NAttributes, :numberofpointmtrs => NMTr, :numberofcorners => NSimplex, :firstnumber => Cint(1), :mesh_dim => Cint(3),)""" @@ -2814,7 +2814,7 @@ end """) == "0.1 + 0.2\n" end - # https://github.com/domluna/JuliaFormatter.jl/issues/77 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/77 @testset "issue 77" begin str_ = """ [ a b Expr() diff --git a/test/options.jl b/test/options.jl index eec4aa39a..328a5fe93 100644 --- a/test/options.jl +++ b/test/options.jl @@ -2063,7 +2063,7 @@ # NOTE: not sure since test makes sense anymore. # It is generally not a great idea to remove the semicolons here since # it can be potentially change the semantics or lead to code errors. - # https://github.com/domluna/JuliaFormatter.jl/issues/745 + # https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/745 @testset "matrices" begin str_ = """ T[ a b Expr(); diff --git a/test/sciml_style.jl b/test/sciml_style.jl index f8a44126f..8ed8b5799 100644 --- a/test/sciml_style.jl +++ b/test/sciml_style.jl @@ -307,7 +307,7 @@ # Test `variable_call_indent` with an inline comment after the opening parenthesis # With `variable_call_indent = false`, the comment will be eaten, - # see https://github.com/domluna/JuliaFormatter.jl/issues/609 + # see https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/609 @test format_text(str, SciMLStyle()) == formatted_str1 @test format_text(str, SciMLStyle(); variable_call_indent = ["Dict"]) == formatted_str2 diff --git a/test/yas_style.jl b/test/yas_style.jl index c6a1c0879..86c87ad18 100644 --- a/test/yas_style.jl +++ b/test/yas_style.jl @@ -736,7 +736,7 @@ # Test `variable_call_indent` with an inline comment after the opening parenthesis # With `variable_call_indent = false`, the comment will be eaten, - # see https://github.com/domluna/JuliaFormatter.jl/issues/609 + # see https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/609 @test format_text(str, YASStyle()) == formatted_str1 @test format_text(str, YASStyle(); variable_call_indent = ["Dict"]) == formatted_str2 From eb0ef15eb2add6a9a10c58fd74d8941976c06744 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 15:34:58 +0100 Subject: [PATCH 02/14] Revert major version bump --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b38498062..e1c767ab8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "JuliaFormatter" uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899" -version = "3.0" -authors = ["Dominique Luna "] +version = "2.3.0" +authors = ["Dominique Luna and contributors"] [deps] CommonMark = "a80b9123-70ca-4bc0-993e-6e3bcb318db6" From a5d2ea7bfd34d680cdccac7d2250f15545f8482a Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 15:38:26 +0100 Subject: [PATCH 03/14] Revert "Update to v3.0 since #959 was a breaking change for pre-commit CI (#971)" This reverts commit 06fc82c7c38b263b009ec01ed15f1eb272ef36bb. --- .github/workflows/PreCommit.yml | 32 ----------------- .pre-commit-config.yaml | 14 +------- .pre-commit-hooks.yaml | 2 +- Project.toml | 2 +- docs/src/integrations.md | 6 ---- src/app.jl | 64 ++++++++++++++++----------------- 6 files changed, 35 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/PreCommit.yml diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml deleted file mode 100644 index 5c5b96ad6..000000000 --- a/.github/workflows/PreCommit.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Pre-Commit - -# needed to allow julia-actions/cache to delete old caches that it has created -permissions: - actions: write - contents: read - -on: - push: - branches: - - master - tags: ['*'] - pull_request: - workflow_dispatch: - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@v2 - - uses: julia-actions/cache@v2 - - run: mkdir ${HOME}/.julia/environments - - run: mkdir ${HOME}/.julia/environments/apps - - name: Install local JuliaFormatter as Pkg app - run: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.Apps.develop(; path=pwd())' - - uses: astral-sh/setup-uv@v7 - - run: uv tool install pre-commit - - run: pre-commit install - - run: | - export PATH=$PATH:${HOME}/.julia/bin/ - pre-commit run --all-files --show-diff-on-failure --color always diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4bdd044c..61f1d0966 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,16 +3,4 @@ repos: - repo: local hooks: - - id: julia-formatter - name: "Julia Formatter" - entry: "jlfmt --inplace" - pass_filenames: true - always_run: false - types: [file] - files: \.(jl|[jq]?md)$ - exclude: '^test/' - language: "system" -- repo: meta - hooks: - - id: check-hooks-apply - - id: check-useless-excludes \ No newline at end of file + - id: "julia-formatter" \ No newline at end of file diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 953a92134..0cde3066b 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,6 +1,6 @@ - id: julia-formatter name: "Julia Formatter" - entry: "jlfmt --inplace" + entry: "julia -e 'import JuliaFormatter: format; format(ARGS)'" pass_filenames: true always_run: false types: [file] diff --git a/Project.toml b/Project.toml index e1c767ab8..b8f3f1b2e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "JuliaFormatter" uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899" -version = "2.3.0" +version = "2.3" authors = ["Dominique Luna and contributors"] [deps] diff --git a/docs/src/integrations.md b/docs/src/integrations.md index b4c8db06c..f1c6cb58d 100644 --- a/docs/src/integrations.md +++ b/docs/src/integrations.md @@ -18,12 +18,6 @@ repos: # ... other repos you may have ``` -Note that it requires the `jlfmt` Pkg app to be installed with - -```julia -pkg> app add JuliaFormatter -``` - You can find a list of releases [here](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/releases). **Be sure to use the entire version string!** (You can double-check this by opening the release and looking at the part of the URL that follows `.../releases/tag/VERSION`.) diff --git a/src/app.jl b/src/app.jl index f8a7f3fb5..6d2bbdb7d 100644 --- a/src/app.jl +++ b/src/app.jl @@ -31,9 +31,9 @@ function scandir!(files, root) elseif (@tryx(isfile(jf), false) || @tryx(islink(jf), false)) # Check for .jl, .md, .jmd, .qmd files if endswith(jf, ".jl") || - endswith(jf, ".md") || - endswith(jf, ".jmd") || - endswith(jf, ".qmd") + endswith(jf, ".md") || + endswith(jf, ".jmd") || + endswith(jf, ".qmd") push!(files, jf) end end @@ -45,10 +45,10 @@ function scandir!(files, root) end function panic( - msg::String, - err::Union{Exception,Nothing} = nothing, - bt::Union{Vector{Base.StackFrame},Nothing} = nothing, -) + msg::String, + err::Union{Exception, Nothing} = nothing, + bt::Union{Vector{Base.StackFrame}, Nothing} = nothing, + ) printstyled(stderr, "ERROR: "; color = :red, bold = true) print(stderr, msg) if err !== nothing @@ -315,7 +315,7 @@ function main(argv::Vector{String}) format_markdown = false config_priority = false style_name = "default" - format_options = Dict{Symbol,Any}() + format_options = Dict{Symbol, Any}() ignore_patterns = String[] paths = String[] @@ -355,7 +355,7 @@ function main(argv::Vector{String}) if i >= length(argv) return panic("expected output file argument after `-o`") end - outputfile = argv[i+1] + outputfile = argv[i + 1] i += 2 elseif startswith(x, "--output=") m = match(r"^--output=(.+)$", x) @@ -562,21 +562,21 @@ function main(argv::Vector{String}) nfiles_str = string(length(inputfiles)) options_list = ( ProcessFileArgs( - inputfile, - file_counter, - nfiles_str, - print_progress, - check, - inplace, - outputfile, - input_is_stdin, - stdin_filename, - config_dir, - format_options, - diff, - format_markdown, - config_priority, - ) for (file_counter, inputfile) in enumerate(inputfiles) + inputfile, + file_counter, + nfiles_str, + print_progress, + check, + inplace, + outputfile, + input_is_stdin, + stdin_filename, + config_dir, + format_options, + diff, + format_markdown, + config_priority, + ) for (file_counter, inputfile) in enumerate(inputfiles) ) # Use multithreading for multiple files (only if multiple threads available) @@ -629,7 +629,7 @@ struct ProcessFileArgs input_is_stdin::Bool stdin_filename::String config_dir::String - format_options::Dict{Symbol,Any} + format_options::Dict{Symbol, Any} diff::Bool format_markdown::Bool config_priority::Bool @@ -739,8 +739,8 @@ function process_file(args::ProcessFileArgs) if args.outputfile == "" || args.outputfile == "-" Output(:stdout, "", stdout, false, false) elseif isfile(args.outputfile) && - !args.input_is_stdin && - samefile(args.outputfile, args.inputfile) + !args.input_is_stdin && + samefile(args.outputfile, args.inputfile) if args.print_progress @lock print_lock begin buf = IOBuffer() @@ -764,7 +764,7 @@ function process_file(args::ProcessFileArgs) effective_options = if args.inputfile != "-" # Find and load .JuliaFormatter.toml config config_nt = find_config_file(args.inputfile) - config_dict = Dict{Symbol,Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) + config_dict = Dict{Symbol, Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) # Merge: by default, command line options override config file # If --prioritize-config-file is set, config file options override command line if args.config_priority @@ -781,7 +781,7 @@ function process_file(args::ProcessFileArgs) # Try to find config file recursively from the directory find_config_file(args.config_dir) end - config_dict = Dict{Symbol,Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) + config_dict = Dict{Symbol, Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) if args.config_priority merge(args.format_options, config_dict) else @@ -795,9 +795,9 @@ function process_file(args::ProcessFileArgs) if args.inputfile != "-" ignore_patterns = get(effective_options, :ignore, String[]) if any( - pattern -> occursin(Glob.FilenameMatch("*$pattern"), args.inputfile), - ignore_patterns, - ) + pattern -> occursin(Glob.FilenameMatch("*$pattern"), args.inputfile), + ignore_patterns, + ) # Skip ignored files if args.print_progress @lock print_lock begin From 6decc40630c3445598bfa6fcd38648e67f719354 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 15:38:43 +0100 Subject: [PATCH 04/14] Remove HELP.md --- HELP.md | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 HELP.md diff --git a/HELP.md b/HELP.md deleted file mode 100644 index 4d9c96ea9..000000000 --- a/HELP.md +++ /dev/null @@ -1,8 +0,0 @@ -Simply put, I'm looking for a new maintainer for JuliaFormatter.jl. I no longer have the bandwidth nor the desire to keep working on this project. If you would like to be involved please reach out to me at the email in my profile. - -You can stop reading at this point if you wish. I'll write a short blurb as to why I'm making this decision. - -* I no longer have the time to meaningfully work on this project. In order for this project to progress someone else has to take the reins. -* I no longer have fun working on this project. There used to be a time where receiving an issue notification in my email was exciting. I would fix the issue, or think about the feature request, and then work on it. This gave me joy. I used really, really enjoy this. Even though this project did everything I ever wanted pre 1.0, if I could make a change that would benefit someone else it would make me happy. The whole concept of "styles" was to be as accommodating as possible. A few years in, this stopped. -* I'm making mistakes. I recently committed a change that broke pre commit CI and truth be told I was an autopilot throughout this - and not the good kind! ()Is there good kind?) I wouldn't have made these errors before , but I'm making them now. -* Realistically, I probably should have done this a couple of years ago. From 137a47527d5d306fd56ebb8f60c3b289c6028689 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 16:32:36 +0100 Subject: [PATCH 05/14] Add a test for pre-commit hook --- .github/workflows/PreCommit.yml | 41 ++++++++++++++++++++++++++++ .github/workflows/pre-commit/main.jl | 3 ++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/PreCommit.yml create mode 100644 .github/workflows/pre-commit/main.jl diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml new file mode 100644 index 000000000..418ba28bb --- /dev/null +++ b/.github/workflows/PreCommit.yml @@ -0,0 +1,41 @@ +name: PreCommit +on: + push: + tags: + - '*' + branches: + - 'master' + pull_request: + branches: + - 'master' + +jobs: + pre-commit: + name: Pre-commit hook + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - uses: julia-actions/setup-julia@v3 + with: + version: '1' + + - name: Install checked out JuliaFormatter in global env + run: | + julia -e 'using Pkg; Pkg.add(; path=".")' + + - uses: actions/setup-python@v6 + with: + python-version: '3.x' + + - name: Run pre-commit hook + working-directory: .github/workflows/pre-commit + run: pipx run pre-commit try-repo ../../../ --files main.jl --verbose + + - name: Verify hook made changes + working-directory: .github/workflows/pre-commit + run: | + git diff --exit-code main.jl && echo "::error::Hook did not modify main.jl" && exit 1 || echo "Hook correctly formatted main.jl" diff --git a/.github/workflows/pre-commit/main.jl b/.github/workflows/pre-commit/main.jl new file mode 100644 index 000000000..eed70a9df --- /dev/null +++ b/.github/workflows/pre-commit/main.jl @@ -0,0 +1,3 @@ +function f(x ) +return x+1 +end From d5e02e5ad6fa82eeb74abea40c4308dcf7b41516 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 16:38:58 +0100 Subject: [PATCH 06/14] Expand pre-commit hook testing --- .github/workflows/PreCommit.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml index 418ba28bb..236528eca 100644 --- a/.github/workflows/PreCommit.yml +++ b/.github/workflows/PreCommit.yml @@ -31,11 +31,15 @@ jobs: with: python-version: '3.x' - - name: Run pre-commit hook - working-directory: .github/workflows/pre-commit - run: pipx run pre-commit try-repo ../../../ --files main.jl --verbose - - - name: Verify hook made changes + - name: Test pre-commit hook working-directory: .github/workflows/pre-commit run: | - git diff --exit-code main.jl && echo "::error::Hook did not modify main.jl" && exit 1 || echo "Hook correctly formatted main.jl" + # Run pre-commit hook, check that it fails. + # pre-commit try-repo will fail if the hook makes changes + pipx run pre-commit try-repo ../../../ --files main.jl --verbose && exit 1 + + # Check that the file was changed. + git diff --exit-code main.jl && exit 1 + + # Check that running the hook again succeeds. + pipx run pre-commit try-repo ../../../ --files main.jl --verbose From 4f823a87200dd761aa3cb600df3c2aa7fdabe57e Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 16:42:00 +0100 Subject: [PATCH 07/14] Clearer naming --- .github/workflows/PreCommit.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml index 236528eca..6c70a7490 100644 --- a/.github/workflows/PreCommit.yml +++ b/.github/workflows/PreCommit.yml @@ -1,3 +1,4 @@ +# This workflow tests that the pre-commit hook works as expected. name: PreCommit on: push: @@ -11,7 +12,7 @@ on: jobs: pre-commit: - name: Pre-commit hook + name: Test julia-formatter pre-commit hook runs-on: ubuntu-latest steps: @@ -36,10 +37,10 @@ jobs: run: | # Run pre-commit hook, check that it fails. # pre-commit try-repo will fail if the hook makes changes - pipx run pre-commit try-repo ../../../ --files main.jl --verbose && exit 1 + pipx run pre-commit try-repo ../../../ julia-formatter --files main.jl --verbose && exit 1 # Check that the file was changed. git diff --exit-code main.jl && exit 1 # Check that running the hook again succeeds. - pipx run pre-commit try-repo ../../../ --files main.jl --verbose + pipx run pre-commit try-repo ../../../ julia-formatter --files main.jl --verbose From dcfaec93150add31e3a3c8ccd5e3d6d8d2d787c4 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 16:47:39 +0100 Subject: [PATCH 08/14] Revert unrelated formatting changes --- src/app.jl | 64 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/app.jl b/src/app.jl index 6d2bbdb7d..f8a7f3fb5 100644 --- a/src/app.jl +++ b/src/app.jl @@ -31,9 +31,9 @@ function scandir!(files, root) elseif (@tryx(isfile(jf), false) || @tryx(islink(jf), false)) # Check for .jl, .md, .jmd, .qmd files if endswith(jf, ".jl") || - endswith(jf, ".md") || - endswith(jf, ".jmd") || - endswith(jf, ".qmd") + endswith(jf, ".md") || + endswith(jf, ".jmd") || + endswith(jf, ".qmd") push!(files, jf) end end @@ -45,10 +45,10 @@ function scandir!(files, root) end function panic( - msg::String, - err::Union{Exception, Nothing} = nothing, - bt::Union{Vector{Base.StackFrame}, Nothing} = nothing, - ) + msg::String, + err::Union{Exception,Nothing} = nothing, + bt::Union{Vector{Base.StackFrame},Nothing} = nothing, +) printstyled(stderr, "ERROR: "; color = :red, bold = true) print(stderr, msg) if err !== nothing @@ -315,7 +315,7 @@ function main(argv::Vector{String}) format_markdown = false config_priority = false style_name = "default" - format_options = Dict{Symbol, Any}() + format_options = Dict{Symbol,Any}() ignore_patterns = String[] paths = String[] @@ -355,7 +355,7 @@ function main(argv::Vector{String}) if i >= length(argv) return panic("expected output file argument after `-o`") end - outputfile = argv[i + 1] + outputfile = argv[i+1] i += 2 elseif startswith(x, "--output=") m = match(r"^--output=(.+)$", x) @@ -562,21 +562,21 @@ function main(argv::Vector{String}) nfiles_str = string(length(inputfiles)) options_list = ( ProcessFileArgs( - inputfile, - file_counter, - nfiles_str, - print_progress, - check, - inplace, - outputfile, - input_is_stdin, - stdin_filename, - config_dir, - format_options, - diff, - format_markdown, - config_priority, - ) for (file_counter, inputfile) in enumerate(inputfiles) + inputfile, + file_counter, + nfiles_str, + print_progress, + check, + inplace, + outputfile, + input_is_stdin, + stdin_filename, + config_dir, + format_options, + diff, + format_markdown, + config_priority, + ) for (file_counter, inputfile) in enumerate(inputfiles) ) # Use multithreading for multiple files (only if multiple threads available) @@ -629,7 +629,7 @@ struct ProcessFileArgs input_is_stdin::Bool stdin_filename::String config_dir::String - format_options::Dict{Symbol, Any} + format_options::Dict{Symbol,Any} diff::Bool format_markdown::Bool config_priority::Bool @@ -739,8 +739,8 @@ function process_file(args::ProcessFileArgs) if args.outputfile == "" || args.outputfile == "-" Output(:stdout, "", stdout, false, false) elseif isfile(args.outputfile) && - !args.input_is_stdin && - samefile(args.outputfile, args.inputfile) + !args.input_is_stdin && + samefile(args.outputfile, args.inputfile) if args.print_progress @lock print_lock begin buf = IOBuffer() @@ -764,7 +764,7 @@ function process_file(args::ProcessFileArgs) effective_options = if args.inputfile != "-" # Find and load .JuliaFormatter.toml config config_nt = find_config_file(args.inputfile) - config_dict = Dict{Symbol, Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) + config_dict = Dict{Symbol,Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) # Merge: by default, command line options override config file # If --prioritize-config-file is set, config file options override command line if args.config_priority @@ -781,7 +781,7 @@ function process_file(args::ProcessFileArgs) # Try to find config file recursively from the directory find_config_file(args.config_dir) end - config_dict = Dict{Symbol, Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) + config_dict = Dict{Symbol,Any}(Symbol(k) => v for (k, v) in pairs(config_nt)) if args.config_priority merge(args.format_options, config_dict) else @@ -795,9 +795,9 @@ function process_file(args::ProcessFileArgs) if args.inputfile != "-" ignore_patterns = get(effective_options, :ignore, String[]) if any( - pattern -> occursin(Glob.FilenameMatch("*$pattern"), args.inputfile), - ignore_patterns, - ) + pattern -> occursin(Glob.FilenameMatch("*$pattern"), args.inputfile), + ignore_patterns, + ) # Skip ignored files if args.print_progress @lock print_lock begin From bbabd1f212a7f773facfc690083524019035a23b Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 16:57:43 +0100 Subject: [PATCH 09/14] Rename workflow for clarity --- .github/workflows/{PreCommit.yml => PreCommitHooks.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{PreCommit.yml => PreCommitHooks.yml} (94%) diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommitHooks.yml similarity index 94% rename from .github/workflows/PreCommit.yml rename to .github/workflows/PreCommitHooks.yml index 6c70a7490..3c1a1c403 100644 --- a/.github/workflows/PreCommit.yml +++ b/.github/workflows/PreCommitHooks.yml @@ -1,5 +1,5 @@ # This workflow tests that the pre-commit hook works as expected. -name: PreCommit +name: PreCommitHooks on: push: tags: @@ -12,7 +12,7 @@ on: jobs: pre-commit: - name: Test julia-formatter pre-commit hook + name: julia-formatter hook runs-on: ubuntu-latest steps: From 390cf8c53701b8f9b872d633355a2a5c4f4a67b6 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 16:59:06 +0100 Subject: [PATCH 10/14] Add PreCommit.yml from #984 Co-authored-by: SundaraRaman R --- .github/workflows/PreCommit.yml | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/PreCommit.yml diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml new file mode 100644 index 000000000..060a841ad --- /dev/null +++ b/.github/workflows/PreCommit.yml @@ -0,0 +1,36 @@ +# This workflow runs pre-commit on the JuliaFormatter repo itself, i.e., +# checks that this repo is formatted. +name: Pre-Commit + +# needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read + +on: + push: + branches: + - master + tags: ['*'] + pull_request: + workflow_dispatch: + +jobs: + pre-commit: + runs-on: ubuntu-latest + timeout-minutes: 120 + + steps: + - uses: actions/checkout@v6 + - uses: julia-actions/setup-julia@v3 + - uses: julia-actions/cache@v3 + + - run: mkdir -p "${HOME}/.julia/environments/apps" + - name: Install local JuliaFormatter as Pkg app + run: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.Apps.develop(; path=pwd())' + + - uses: astral-sh/setup-uv@v8.1.0 + - run: uv tool install pre-commit + - run: | + export PATH=$PATH:${HOME}/.julia/bin/ + pre-commit run --all-files --show-diff-on-failure --color always From bcbb500325e69f03e67d57e79d3f7d1f909facc1 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 17:37:58 +0100 Subject: [PATCH 11/14] Fix pre-commit config --- .pre-commit-config.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61f1d0966..a87f8a14c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,4 +3,16 @@ repos: - repo: local hooks: - - id: "julia-formatter" \ No newline at end of file + - id: julia-formatter + name: "Julia Formatter" + entry: "jlfmt --inplace" + pass_filenames: true + always_run: false + types: [file] + files: \.(jl|[jq]?md)$ + exclude: '^(test/|\.github/)' + language: "system" +- repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes From 669571851a08e7871329b8cf3c0fa358a77fa773 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 17:39:34 +0100 Subject: [PATCH 12/14] Format :) --- Project.toml | 2 +- docs/make.jl | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b8f3f1b2e..e1c767ab8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "JuliaFormatter" uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899" -version = "2.3" +version = "2.3.0" authors = ["Dominique Luna and contributors"] [deps] diff --git a/docs/make.jl b/docs/make.jl index 4b42c84bc..8784bf841 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -21,4 +21,7 @@ makedocs(; warnonly = true, ) -deploydocs(; repo = "github.com/JuliaEditorSupport/JuliaFormatter.jl.git", push_preview = true) +deploydocs(; + repo = "github.com/JuliaEditorSupport/JuliaFormatter.jl.git", + push_preview = true, +) From a962cfab872a8ae105b741638541311906638af1 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Fri, 15 May 2026 17:42:01 +0100 Subject: [PATCH 13/14] Tidy workflow --- .github/workflows/PreCommit.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml index 060a841ad..d96a73f9c 100644 --- a/.github/workflows/PreCommit.yml +++ b/.github/workflows/PreCommit.yml @@ -22,13 +22,14 @@ jobs: steps: - uses: actions/checkout@v6 + + # Note: Pkg App support only in >= 1.12 - uses: julia-actions/setup-julia@v3 + - uses: julia-actions/cache@v3 - - run: mkdir -p "${HOME}/.julia/environments/apps" - name: Install local JuliaFormatter as Pkg app run: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.Apps.develop(; path=pwd())' - - uses: astral-sh/setup-uv@v8.1.0 - run: uv tool install pre-commit - run: | From 7daed4da0c0a8e23abe4fe3715121bc3aed472fb Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 20 May 2026 17:40:39 +0100 Subject: [PATCH 14/14] Simplify pre-commit installation --- .github/workflows/PreCommit.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/PreCommit.yml b/.github/workflows/PreCommit.yml index e0efb6312..9adb32946 100644 --- a/.github/workflows/PreCommit.yml +++ b/.github/workflows/PreCommit.yml @@ -31,8 +31,11 @@ jobs: - name: Install local JuliaFormatter as Pkg app run: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.Apps.develop(; path=pwd())' - - uses: astral-sh/setup-uv@v8.1.0 - - run: uv tool install pre-commit - - run: | + - uses: actions/setup-python@v6 + with: + python-version: '3.x' + + - name: Run pre-commit hooks + run: | export PATH=$PATH:${HOME}/.julia/bin/ - pre-commit run --all-files --show-diff-on-failure --color always + pipx run pre-commit run --all-files --show-diff-on-failure --color always