domluna / JuliaFormatter.jl

An opinionated code formatter for Julia. Plot twist - the opinion is your own.
https://domluna.github.io/JuliaFormatter.jl/dev/
MIT License
581 stars 69 forks source link

Feature request: package tests with feedback #871

Open adrhill opened 2 months ago

adrhill commented 2 months ago

I like to use @test JuliaFormatter.format(MyPackage; verbose=false, overwrite=false) in the tests of packages I develop. It ensures only formatted code gets merged via CI.

However, I've recently gotten feedback that this "creates a barrier to contributions"^1 and that contributors have "no clue what was causing it or how to fix it"^2.

It would be nice to have a testing utility that prints beginner-friendly usage instructions for JuliaFormatter and/or a diff when the test fails.

CC @greimel @eford

domluna commented 1 month ago

I think in the rewrite to JuliaSyntax friendlier messages will be possible, since it locates the exact part of the file that's problematic.

adrhill commented 1 month ago

Would you be open to a PR which adds a JuliaFormatter.test_formatting() function that is a thin wrapper around format with additional usage instructions in case of a failure?

domluna commented 1 month ago

sure i dont see why not

On Monday, October 7, 2024, Adrian Hill @.***> wrote:

Would you be open to a PR which adds a JuliaFormatter.test_formatting() function that is a thin wrapper around format with additional usage instructions in case of a failure?

— Reply to this email directly, view it on GitHub https://github.com/domluna/JuliaFormatter.jl/issues/871#issuecomment-2396821601, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAORUF6CWBY4ZOOJQCVNCF3Z2J6QXAVCNFSM6AAAAABON7IYTOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJWHAZDCNRQGE . You are receiving this because you commented.Message ID: @.***>