Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Closed
2 tasks done
jszumski opened this issue Mar 28, 2018 · 0 comments
Closed
2 tasks done

Comments

@jszumski
Copy link
Contributor

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
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant