Skip to content

False positive for RemoveLine when using #if directive #372

@FlineDevPublic

Description

@FlineDevPublic

I've just ran across a weird auto-correction and lint warning when I tried to provide iOS-only modifiers in a SwiftUI view. When running the lint command in Xcode, the warnings look like this:

Screen Shot 2022-05-20 at 13 01 02

And when running the corrections, swift-format corrects my code to this (which is ugly IMO):
Screen Shot 2022-05-20 at 13 05 24

I also couldn't find a configuration option to turn these warnings off, too. Both RemoveLine and Indentation are false positives in my opinion and I couldn't find either of these rules in the config file.

Also, disabling the Indentation didn't work, this still shows a violation:

.navigationBarTitle(L10n.Timer.EditSummaryScreen.title)  // swift-format-ignore: Indentation

By the way, I'm not sure if just reporting issues with a normal title is the correct approach here. The GitHub organization doesn't seem to have an issue template yet (with things like "steps to reproduce", "expected state" etc.). It feels weird being the first reporting an issue without the [SR...] prefix after the migration from JIRA. 😅


This issue was reported during my regular Open Source live stream on Twitch. Follow me there to support my work!

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