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

Add a command to disable a rule for a single line #222

Closed
jpsim opened this issue Nov 19, 2015 · 6 comments
Closed

Add a command to disable a rule for a single line #222

jpsim opened this issue Nov 19, 2015 · 6 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@jpsim
Copy link
Collaborator

jpsim commented Nov 19, 2015

For example:

// swiftlint:disable:next force_cast
let forceCastNoWarning = NSNumber() as! Int
let forceCastWithWarning = NSNumber() as! Int

Although I'm not convinced on the naming. Maybe // swiftlint:disable:X where X is an integer number of lines for which to disable the rule?

It would make it more convenient to temporarily disable rules for occasional violations.

@jpsim jpsim added the enhancement Ideas for improvements of existing features and rules. label Nov 19, 2015
@segiddins
Copy link
Contributor

Why not just allow putting it at the end of the line, like rubocop does?

@jpsim
Copy link
Collaborator Author

jpsim commented Nov 19, 2015

Why not just allow putting it at the end of the line, like rubocop does?

so // swiftlint:disable rule_name would start a region if preceded by whitespace, but start and close a single-line region otherwise?

@segiddins
Copy link
Contributor

Yeah. Not necessarily saying it's better, and it might clash with the line length rule

@richellis
Copy link

+1 for the suggestion about putting it at the end of the line. Perhaps an abbreviated syntax to mitigate line length issues, such as //sl: rule_name

@mpurland
Copy link

mpurland commented Dec 3, 2015

+1 for this suggestion

jpsim added a commit that referenced this issue Dec 25, 2015
jpsim added a commit that referenced this issue Dec 25, 2015
jpsim added a commit that referenced this issue Dec 28, 2015
@jpsim
Copy link
Collaborator Author

jpsim commented Dec 30, 2015

Done in #292.

@jpsim jpsim closed this as completed Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

No branches or pull requests

4 participants