Apply JuliaFormatter to fix code formatting#318
Closed
ChrisRackauckas wants to merge 1 commit intoSciML:masterfrom
Closed
Apply JuliaFormatter to fix code formatting#318ChrisRackauckas wants to merge 1 commit intoSciML:masterfrom
ChrisRackauckas wants to merge 1 commit intoSciML:masterfrom
Conversation
- Applied JuliaFormatter with SciML style guide - Formatted 10 files 🤖 Generated by OrgMaintenanceScripts.jl
Member
Author
ChrisRackauckas
pushed a commit
to ChrisRackauckas/JuliaFormatter.jl
that referenced
this pull request
Jul 29, 2025
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>
Merged
7 tasks
domluna
pushed a commit
to domluna/JuliaFormatter.jl
that referenced
this pull request
Jul 30, 2025
) * 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
This PR was automatically generated by OrgMaintenanceScripts.jl