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

opening_brace violation issue #1811

Closed
tungfam opened this issue Aug 31, 2017 · 2 comments
Closed

opening_brace violation issue #1811

tungfam opened this issue Aug 31, 2017 · 2 comments
Labels
bug Unexpected and reproducible misbehavior.

Comments

@tungfam
Copy link

tungfam commented Aug 31, 2017

Running v 0.22.0 and checked the created issues.

Bug Report

Here is my code:
screen shot 2017-08-31 at 12 57 47 pm

The warning says:

Opening Brace Spacing Violation: Opening braces should be preceded by a single space and on the same line as the declaration. (opening_brace)

Adding disable rule:
screen shot 2017-08-31 at 1 00 01 pm

And got this issue:

Superfluous Disable Command Violation: SwiftLint rule 'opening_brace' did not trigger a violation in the disabled region. Please remove the disable command. (superfluous_disable_command)

Issue: There is a conflict of warning and error.

PS: though, disabling using //swiftlint:disable opening_brace works. but if use :this - having issues.

@marcelofabri
Copy link
Collaborator

The issue is that opening_brace rule currently does not do a very good job on reporting the location.

I'd suggest you to use one of the alternatives:

func foo()
{ // swiftlint:disable:previous opening_brace

}

// swiftlint:disable:next opening_brace
func foo()
{

}

Alternatively, you can disable superfluous_disable_command as you'd with any rule: in your configuration or with comments.

I think we should keep this open to track improving opening_brace violation locations.

@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label Aug 31, 2017
@tungfam
Copy link
Author

tungfam commented Aug 31, 2017

Yeah, I made a workaround. Thanks!

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

No branches or pull requests

2 participants