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

Disable/re-enable rules from within source code comments. Fixes #4. #111

Merged
merged 6 commits into from
Sep 1, 2015

Conversation

jpsim
Copy link
Collaborator

@jpsim jpsim commented Aug 30, 2015

First draft addressing #4. Still need to write some tests, but seems to be working from what I can tell from manually testing. /cc @keith @segiddins


extension File {
public func regions() -> [Region] {
let nsStringContents = contents as NSString
let commands = matchPattern("swiftlint:(enable|disable):force_cast")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't force_cast be .+ and then captured to determine which rule it is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rule capturing was already being done by NSScanner, but I had accidentally hardcoded force_cast in here as part of my testing.

@jpsim
Copy link
Collaborator Author

jpsim commented Sep 1, 2015

Good enough! :shipit:

jpsim added a commit that referenced this pull request Sep 1, 2015
Disable/re-enable rules from within source code comments. Fixes #4.
@jpsim jpsim merged commit 56fe7b0 into master Sep 1, 2015
@jpsim jpsim deleted the jp-comment-commands branch September 1, 2015 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants