New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocorrect for "redundant_void_return" corrupts file when preprocessor macros are present #2115

Closed
jszumski opened this Issue Mar 28, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@jszumski
Contributor

jszumski commented Mar 28, 2018

New Issue Checklist

This is almost identical to #2099.

Bug Report

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint autocorrect --path Foo.swift
Correcting Swift files at path Foo.swift
Correcting 'Foo.swift' (1/1)
Foo.swift:3:15 Corrected Redundant Void Return
Foo.swift:3:15 Corrected Redundant Void Return
Done correcting 1 files!

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.25.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
  • Paste your configuration file:
whitelist_rules:
  - redundant_void_return
  • Are you using nested configurations? If so, paste their relative paths and respective contents. no
  • Which Xcode version are you using (check xcode-select -p)? 9.2

Steps to Reproduce

Source File

protocol Foo {
    #if true
    func foo() -> Void
    #endif
}

Run autocorrect

$ swiftlint autocorrect --path Foo.swift
Correcting Swift files at path Foo.swift
Correcting 'Foo.swift' (1/1)
Foo.swift:3:15 Corrected Redundant Void Return
Foo.swift:3:15 Corrected Redundant Void Return
Done correcting 1 files!

Corrected File

The duplicate correction ends up truncating remaining parts of the file.

protocol Foo {
    #if true
    func foo()dif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment