Skip to content

Conversation

ChrisRackauckas
Copy link
Member

Summary

Fix unnecessary line splits in Julia code following the guidelines established in Catalyst.jl PR #1306. This PR improves code readability by consolidating short expressions that were unnecessarily split across multiple lines.

Background

These formatting issues are being addressed upstream in JuliaFormatter.jl PR #934, which implements algorithmic fixes to prevent these unnecessary line splits. However, since that PR is not yet merged, manual fixes are needed in the meantime to improve code readability.

Changes Made

Fixed 5 instances of problematic line splits in test files:

  • test/default_algs.jl: 1 test assertion
  • test/basictests.jl: 4 test assertions

Example Fix

Before:

@test LinearSolve.defaultalg(op1, x1).alg ===
      LinearSolve.DefaultAlgorithmChoice.DirectLdiv\!

After:

@test LinearSolve.defaultalg(op1, x1).alg === LinearSolve.DefaultAlgorithmChoice.DirectLdiv\!

Rationale

Following Catalyst.jl PR #1306's approach:

  • Prioritize readability over strict formatter rules for short expressions
  • Keep semantically related code units together
  • All modified lines stay well under 120 characters
  • Use JuliaFormatter as a helpful tool rather than a strict rule enforcer

Note

This is part of a systematic effort to apply the same formatting improvements across multiple SciML repositories including JumpProcesses.jl, OrdinaryDiffEq.jl, NonlinearSolve.jl, and ModelingToolkit.jl.

🤖 Generated with Claude Code

Fix unnecessarily split test assertions in default_algs.jl and basictests.jl
following Catalyst.jl PR #1306 guidelines for improved readability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas ChrisRackauckas merged commit 14ae8c5 into main Aug 1, 2025
37 of 40 checks passed
@ChrisRackauckas ChrisRackauckas deleted the fix-formatter-line-splits branch August 1, 2025 11:42
Comment on lines +510 to +511
@test LinearSolve.defaultalg(op1, x1).alg === LinearSolve.DefaultAlgorithmChoice.DirectLdiv!
@test LinearSolve.defaultalg(op2, x2).alg === LinearSolve.DefaultAlgorithmChoice.DirectLdiv!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@test LinearSolve.defaultalg(op1, x1).alg === LinearSolve.DefaultAlgorithmChoice.DirectLdiv!
@test LinearSolve.defaultalg(op2, x2).alg === LinearSolve.DefaultAlgorithmChoice.DirectLdiv!
@test LinearSolve.defaultalg(op1, x1).alg ===
LinearSolve.DefaultAlgorithmChoice.DirectLdiv!
@test LinearSolve.defaultalg(op2, x2).alg ===
LinearSolve.DefaultAlgorithmChoice.DirectLdiv!

@@ -1,7 +1,6 @@
using LinearSolve, RecursiveFactorization, LinearAlgebra, SparseArrays, Test

@test LinearSolve.defaultalg(nothing, zeros(3)).alg ===
LinearSolve.DefaultAlgorithmChoice.GenericLUFactorization
@test LinearSolve.defaultalg(nothing, zeros(3)).alg === LinearSolve.DefaultAlgorithmChoice.GenericLUFactorization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@test LinearSolve.defaultalg(nothing, zeros(3)).alg === LinearSolve.DefaultAlgorithmChoice.GenericLUFactorization
@test LinearSolve.defaultalg(nothing, zeros(3)).alg ===
LinearSolve.DefaultAlgorithmChoice.GenericLUFactorization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants