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

Make joined_default_parameter rule correctable #1757

Closed
ornithocoder opened this issue Aug 8, 2017 · 2 comments
Closed

Make joined_default_parameter rule correctable #1757

ornithocoder opened this issue Aug 8, 2017 · 2 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@ornithocoder
Copy link
Contributor

as discussed with @marcelofabri #1746.

@marcelofabri marcelofabri added the enhancement Ideas for improvements of existing features and rules. label Aug 8, 2017
@ornithocoder
Copy link
Contributor Author

ornithocoder commented Aug 8, 2017

@marcelofabri is there any rule for creating regular expressions for correctable rules? Should I build a rule that accepts blank spaces everywhere - e.g. . join ( separator : "" ) - or go for something more basic like \.joined\(separator:\s*?\"\"\), leaving the blank spaces to be taken care by other rules?

@marcelofabri
Copy link
Collaborator

In this case, I wouldn't use regexes at all. You already have all needed information from SourceKit:

{
	"key.namelength": 9,
	"key.nameoffset": 12,
	"key.length": 13,
	"key.name": "separator",
	"key.bodyoffset": 23,
	"key.bodylength": 2,
	"key.kind": "source.lang.swift.expr.argument",
	"key.offset": 12
}

Replacing the range (location: key.offset, length: key.length) with an empty string should work.

ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Aug 8, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Aug 8, 2017
ornithocoder added a commit to ornithocoder/personal-fork-swiftlint that referenced this issue Aug 8, 2017
marcelofabri pushed a commit that referenced this issue Aug 17, 2017
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

2 participants