Skip to content
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

allow_multiline_func doesn't account for init methods #3470

Closed
2 tasks done
thibault-ml opened this issue Dec 17, 2020 · 4 comments · Fixed by #5164
Closed
2 tasks done

allow_multiline_func doesn't account for init methods #3470

thibault-ml opened this issue Dec 17, 2020 · 4 comments · Fixed by #5164
Labels
bug Unexpected and reproducible misbehavior.

Comments

@thibault-ml
Copy link

New Issue Checklist

Describe the bug

The allow_multiline_func option in the opening_brace rule does not work for init methods.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Linting Swift files in current working directory
Linting 'SomeClass.swift' (1/1)
/tmp/testswiftlintrule/SomeClass.swift:9:5: warning: Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version: 0.42.0
  • Installation method used: Homebrew
  • Paste your configuration file:
opening_brace:
  allow_multiline_func: true

Sample code

// swiftlint:disable multiline_parameters_brackets indentation_width
/// Doc
public struct SomeClass {
    /// Doc
    public init(firstParameter: String,
                secondParameter: String,
                thirdParameter: String,
                fourthParameter: String)
    { // This DOES triggers a violation
        print("Hello world")
    }

    /// Doc
    public func someMethod(firstParameter: String,
                           secondParameter: String,
                           thirdParameter: String,
                           fourthParameter: String)
    { // This does NOT triggers a violation
        print("Hello world")
    }
}
@thibault-ml
Copy link
Author

My guess is that this regex needs to include init, unless we have a better way to determine we're in init?

@stale
Copy link

stale bot commented Feb 15, 2021

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

@stale stale bot added the wontfix Issues that became stale and were auto-closed by a bot. label Feb 15, 2021
@thibault-ml
Copy link
Author

thibault-ml commented Feb 16, 2021

Mmh, this is not really stale unfortunately, it hasn't been fixed as far as I am aware.

@stale stale bot removed the wontfix Issues that became stale and were auto-closed by a bot. label Feb 16, 2021
@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Feb 25, 2021
@RaimundasSakalauskas
Copy link

I can confirm that this is still happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants