JuliaFormatter.jl
JuliaFormatter.jl copied to clipboard
Code coverage style
I was wondering if there could be a super verbose style that does things like expand cond && X
to
if cond
X
end
Then the formatter could be run in CI before the tests using this style so that the code coverage would be more accurate.
yeah definitely possible. This would need to work for nested cases of && and || too though right?
Yeah, like cond1 && cond2 || cond3 || statement
. I guess ideally it wouldn’t expand things that if they end with boolean, although I don’t how doable that is.
I’m not sure what other changes would be good for code cov. I guess if there’s expr1; expr2
then that would be better as two lines, although that seems uncommon / bad style anyway.
I wonder if there’s a way to write function signatures where there’s an optional argument to have the default be on a separate line? So then you can get coverage for each path (default or not).
One issue with using a different style in tests for code coverage is that eg CodeCov can do inline annotations on the git diff, and it might get mixed up if the code in the PR is formatted differently than the code being tested.
I’m not sure what other changes would be good for code cov. I guess if there’s expr1; expr2 then that would be better as two lines, although that seems uncommon / bad style anyway.
afaik this already happens
I wonder if there’s a way to write function signatures where there’s an optional argument to have the default be on a separate line? So then you can get coverage for each path (default or not).
This can just be how the style works - it's easy to do.
I'm just holding off on "big" changes until CSTParser v3 upgrade is done to avoid dealing with merge conflicts since internally some things are somewhat different.