ModelingToolkit.jl icon indicating copy to clipboard operation
ModelingToolkit.jl copied to clipboard

refactor: format

Open AayushSabharwal opened this issue 5 months ago • 14 comments

Checklist

  • [ ] Appropriate tests were added
  • [ ] Any code changes were done in a way that does not break public API
  • [ ] All documentation related to code changes were updated
  • [ ] The new code follows the contributor guidelines, in particular the SciML Style Guide and COLPRAC.
  • [ ] Any new documentation only uses public API

Additional context

Add any other context about the problem here.

AayushSabharwal avatar Jun 09 '25 06:06 AayushSabharwal

Formatting failed 😅

ChrisRackauckas avatar Jun 09 '25 07:06 ChrisRackauckas

Yeah, JuliaFormatter v2 doesn't like bipartite_graphs.jl for some reason and errors out in CI. This is formatted with v1 locally.

AayushSabharwal avatar Jun 09 '25 07:06 AayushSabharwal

Would you prefer I make CI use v1?

AayushSabharwal avatar Jun 09 '25 07:06 AayushSabharwal

No we should update to v2. We should just change the code to make it happy then.

ChrisRackauckas avatar Jun 09 '25 07:06 ChrisRackauckas

I'll see if I can figure out what it is unhappy about. The error message is incredibly unhelpful. There also doesn't seem to be an option to increase the fixpoint iterations.

AayushSabharwal avatar Jun 09 '25 08:06 AayushSabharwal

struct Matching{U, V <: AbstractVector} <: AbstractVector{Union{U, Int}} #=> :Unassigned =#
    match::V
    inv_match::Union{Nothing, V}
end

It specifically doesn't like that inline comment.

AayushSabharwal avatar Jun 09 '25 12:06 AayushSabharwal

just put it above the struct.

ChrisRackauckas avatar Jun 09 '25 12:06 ChrisRackauckas

https://github.com/domluna/JuliaFormatter.jl/issues/924

AayushSabharwal avatar Jun 09 '25 12:06 AayushSabharwal

The comment is not very meaningful anyway, and putting it above the struct also fails. I've removed it. This will be a massive PR, unfortunately.

AayushSabharwal avatar Jun 09 '25 12:06 AayushSabharwal

I'll push the changes, but I find a lot of it pretty questionable

AayushSabharwal avatar Jun 09 '25 12:06 AayushSabharwal

conflict

ChrisRackauckas avatar Jun 09 '25 14:06 ChrisRackauckas

Well yes, but I don't think upgrading to JuliaFormatter@2 is worth it. Most of these changes are nonsensical and worse code quality.

AayushSabharwal avatar Jun 09 '25 14:06 AayushSabharwal

It's even split multidimensional array indexing into multiple lines in some places for some reason

AayushSabharwal avatar Jun 09 '25 14:06 AayushSabharwal

Point them all out for @domluna

ChrisRackauckas avatar Jun 09 '25 14:06 ChrisRackauckas