-
-
Notifications
You must be signed in to change notification settings - Fork 236
Add .JuliaFormatter #1590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .JuliaFormatter #1590
Conversation
da0d879 to
b355047
Compare
| aeqs = algeqs(state.structure) | ||
| var_eq_matching = Matching{Union{Unassigned, SelectedState}}(tear_graph_modia(state.structure; | ||
| varfilter=var->var in algvars, eqfilter=eq->eq in aeqs)) | ||
| varfilter = var -> var in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These few lines seem a bit awkward. This could be a good-looking resolution:
var_eq_matching = Matching{Union{Unassigned, SelectedState}}(
tear_graph_modia(state.structure; varfilter = var -> var in algvars, eqfilter = eq -> eq in aeqs))
But this goes against the idea that function arguments should be aligned with the opening bracked. It might be helpful to allow arguments on new lines, even if just for cases like this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's easier to just write two lines in this case.
| ps::Vector | ||
| """Array variables.""" | ||
| var_to_name | ||
| var_to_name::Any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it doesn't matter, but would it make more sense for this to be Dict{Symbol,Any} rather than Any as the formatter is selecting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be disabled with https://github.com/domluna/JuliaFormatter.jl#annotate_untyped_fields_with_any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to have untyped fields to be any, but yes, in this case, it should be Dict{Symbol,Any}
|
Thanks everyone for reviewing! Seems like there are only a few edge cases left that can be resolved by manual formatting. Let's track this in an issue. |
It's SciML/Sundials.jl#357 with