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

Rule control_statement reports methods with keyword names #1946

Closed
frenetisch-applaudierend opened this Issue Nov 13, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@frenetisch-applaudierend
Contributor

frenetisch-applaudierend commented Nov 13, 2017

New Issue Checklist

Bug Report

Swiftlint version: 0.24.0
Installation method: Homebrew

The control_statement rule reports methods that have names equal to the control statement keywords. This is an issue if you e.g. use PromiseKit that uses catch in one of their method names.

The following triggers the rule and should not in my opinion:

func test() {
    foo().catch(all: true) {}
}
$ echo "foo().catch(all: true) {}" | swiftlint lint --no-cache --use-stdin --enable-all-rules
Loading configuration from '.swiftlint.yml'
<nopath>:1:7: warning: Control Statement Violation: if,for,while,do,catch statements shouldn't wrap their conditionals or arguments in parentheses. (control_statement)
Done linting! Found 1 violation, 0 serious in 1 file.
@Lutzifer

This comment has been minimized.

Show comment
Hide comment
@Lutzifer

Lutzifer Nov 15, 2017

Second that

Lutzifer commented Nov 15, 2017

Second that

@marcelofabri marcelofabri added the bug label Nov 28, 2017

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Dec 5, 2017

dirtydanee pushed a commit to dirtydanee/SwiftLint that referenced this issue Dec 18, 2017

dirtydanee pushed a commit to dirtydanee/SwiftLint that referenced this issue Dec 18, 2017

Fix false positives in control_statement when methods with keyword na…
…mes are used

Fixes realm#1946 (+1 squashed commit)
Squashed commits:
[4cdcc48] Updates changelog entry

dirtydanee pushed a commit to dirtydanee/SwiftLint that referenced this issue Dec 18, 2017

Adds new opt-in rule, private_action
Implements realm#1931. (+1 squashed commit)
Squashed commits:
[5911dcc] Fix false positives in control_statement when methods with keyword names are used

Fixes realm#1946 (+1 squashed commit)
Squashed commits:
[4cdcc48] Updates changelog entry

dirtydanee pushed a commit to dirtydanee/SwiftLint that referenced this issue Dec 18, 2017

Fix false positives in control_statement when methods with keyword na…
…mes are used

Fixes realm#1946 (+1 squashed commit)
Squashed commits:
[4cdcc48] Updates changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment