-
-
Notifications
You must be signed in to change notification settings - Fork 38
Apply JuliaFormatter to fix code formatting #356
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
Conversation
- Applied JuliaFormatter with SciML style guide - Formatted 16 files 🤖 Generated by OrgMaintenanceScripts.jl
| A * u[II[i, j, 1]] - u[II[i, j, 1]]^2 * u[II[i, j, 2]] | ||
| du[II[i, | ||
| j, |
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.
JuliaFormatter v2 is pretty mangled and messes up a lot of lines like this, can we just have the same thing we had with JuliaFormatter v1 @domluna? What's the reason for changing the style?
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.
Agreed, this is currently our group's main issue with JuliaFormatter.
Previously, I just made PRs for things like this myself, but unfortunately, I don't have time to invest into this now.
Added extensive regression tests based on actual formatting issues found in SciML repositories that were broken by JuliaFormatter v2. These tests ensure that the most common problematic patterns don't reoccur. Test coverage includes: - DiffEqGPU.jl array indexing issues (II[i, j, 1] patterns) - @unpack macro formatting from multiple repos - Function call assignment breaking - Complex constructor calls and nested expressions - Mathematical expressions with array indexing - Type parameter formatting - Closure definitions and macro calls - Array slicing operations - Multiple assignment patterns - Nested array access patterns Tests are based on real examples from: - SciML/DiffEqGPU.jl#356 - SciML/DelayDiffEq.jl#318 - SciML/BoundaryValueDiffEq.jl#354 - SciML/MultiScaleArrays.jl#99 - And many other SciML repositories These tests will prevent future regressions and ensure SciMLStyle continues to work well for scientific computing code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
) * Fix excessive line breaking in SciMLStyle for readable expressions Addresses the formatting regression introduced in JuliaFormatter v2 where commonly-used expressions were being broken across multiple lines, reducing code readability. Fixes several expression types: - Array indexing: II[i, j, 1] no longer broken across lines - Macro calls: @unpack statements keep reasonable line breaks - Function calls: Avoid awkward breaks in function calls - Type parameters: Keep Type{A, B, C} compact - Vector literals: Short vectors stay on one line when possible The fix is implemented by making find_optimal_nest_placeholders() more conservative for specific expression types that benefit from staying compact. Each type gets appropriate thresholds for placeholder count and margin tolerance. Fixes: https://github.com/SciML/DiffEqGPU.jl/pull/356/files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix test failures by refining conservative line breaking logic Fixed two failing SciML tests by making the Curly type line breaking logic more sensitive to margin constraints. The previous fix was too aggressive and prevented necessary line breaks in Union types when margins were extremely tight (margin=1). Changes: - Added margin-based logic for Curly types to allow line breaks when needed - Maintained aggressive protection for RefN (array indexing) to prevent the original issue - All tests now pass including the comprehensive fix tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Enhance conservative line breaking for macro calls Made MacroCall protection more aggressive to better handle complex macro expressions like @time/@sync chains. While this doesn't fully solve all macro assignment breaking issues, it improves protection for most cases. Changes: - Increased MacroCall placeholder limit from 6 to 10 - Increased MacroCall margin tolerance from +30 to +60 - Better protection for complex macro expressions Note: Some very long macro assignments may still break due to deeper formatting logic that needs additional investigation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Add comprehensive SciML regression tests from real repositories Added extensive regression tests based on actual formatting issues found in SciML repositories that were broken by JuliaFormatter v2. These tests ensure that the most common problematic patterns don't reoccur. Test coverage includes: - DiffEqGPU.jl array indexing issues (II[i, j, 1] patterns) - @unpack macro formatting from multiple repos - Function call assignment breaking - Complex constructor calls and nested expressions - Mathematical expressions with array indexing - Type parameter formatting - Closure definitions and macro calls - Array slicing operations - Multiple assignment patterns - Nested array access patterns Tests are based on real examples from: - SciML/DiffEqGPU.jl#356 - SciML/DelayDiffEq.jl#318 - SciML/BoundaryValueDiffEq.jl#354 - SciML/MultiScaleArrays.jl#99 - And many other SciML repositories These tests will prevent future regressions and ensure SciMLStyle continues to work well for scientific computing code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Changes
This PR was automatically generated by OrgMaintenanceScripts.jl