Skip to content

Every fantomas run adding one more empty line #3486

Description

@Thorium

I have an issue where my files keep growing with empty space because every Fantomas run inserts yet another empty line.

Issue created from fantomas-online

Code

    [<Fact>]
    let ``solve should reject problem too large for backend`` () =
        let backend: BackendAbstraction.IQuantumBackend = createLocalBackend () // Max 16 qubits
        // 5 cities requires 5*5 = 25 qubits (exceeds limit)
        let distances = Array2D.zeroCreate 6 6

        let result = solveWithShots backend distances 100

        match result with
        | Error err ->
            Assert.Contains("qubits", err.Message)
            // Backend name should be in error message (type resolution issue prevents checking directly)
            // Assert.Contains(backend.Name, err.Message)


        | Ok _ -> Assert.True(false, "Should reject problem too large")

Result

[<Fact>]
let ``solve should reject problem too large for backend`` () =
    let backend: BackendAbstraction.IQuantumBackend = createLocalBackend () // Max 16 qubits
    // 5 cities requires 5*5 = 25 qubits (exceeds limit)
    let distances = Array2D.zeroCreate 6 6

    let result = solveWithShots backend distances 100

    match result with
    | Error err ->
        Assert.Contains("qubits", err.Message)
        // Backend name should be in error message (type resolution issue prevents checking directly)
        // Assert.Contains(backend.Name, err.Message)




    | Ok _ -> Assert.True(false, "Should reject problem too large")

Problem description

Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.

Extra information

  • The formatted result breaks my code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.
  • I would like a release if this problem is solved.

Options

Fantomas main branch at 2026-09-21T07:05:24Z - 12bb5e6

Default Fantomas configuration

Did you know that you can ignore files when formatting by using a .fantomasignore file?
PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.

Activity

  1. nojaf commented on Sep 22, 2026

    @nojaf
    Contributor

    Probably fixed in 8.0.2, please try that first.

  2. Thorium commented on Sep 22, 2026

    @Thorium
    MemberAuthor

    Still happens in 8.0.2

    The other format is if-else inside match:

                                match qualityOpt with
                                | Some qualitySpec ->
                                    let dims = parseQualityDimensions qualitySpec
    
                                    if dims.IsEmpty then
                                        printfn $"Warning: no valid quality dimensions parsed from: {qualitySpec}"
                                    else
                                        printfn $"[quality] Dimensions requested: {qualitySpec}"
                                        // The evaluators, context builders, and composite evaluator are all
                                        // functional and tested (createQualityEvaluator, buildQualityContext,
                                        // ...
    
    
    
    
    
                                | None -> ()
  3. nojaf commented on Sep 22, 2026

    @nojaf
    Contributor

    Not sure if I'm buying it, in online tool (picking v8.x):
    I get

    Image

    I don't get this on main.

  4. nojaf commented on Sep 22, 2026

    @nojaf
    Contributor

    It just looks like the same problem as #3484

  5. Thorium commented on Sep 22, 2026

    @Thorium
    MemberAuthor

    Yes looks duplicate to me.
    Maybe I updated the local to 8.0.2 but still called a global 8.0.1
    Closing it for now, let's consider it fixed.

  6. Thorium commented on Sep 22, 2026

    @Thorium
    MemberAuthor

    Thanks for quick reaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions