Skip to content

PrettyPrinter reports wrong line numbers #882

Open
@bkolb

Description

@bkolb

I have a file with a copyright header. This leads to the reporting of wrong line numbers in rules like EndOfLineComment

Here is an example where the reporting works as expected:

final class A {
    @Test func b() throws {
        doSomethingInAFunctionWithAVeryLongName()  1️⃣// Here we have a very long comment that should not be here because it is far too long
    }
}

Changing the input to the following will fail:

// Copyright (C) 2024 My Coorp. All rights reserved.
//
// This document is the property of My Coorp.
// It is considered confidential and proprietary.
//
// This document may not be reproduced or transmitted in any form,
// in whole or in part, without the express written permission of
// My Coorp.

final class A {
    @Test func b() throws {
        doSomethingInAFunctionWithAVeryLongName()  1️⃣// Here we have a very long comment that should not be here because it is far too long
    }
}

The error is here is reported in location (line:col 5:52) and should be in (line:col 12:52)

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