-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 configuration for for_where
rule
#4040
Labels
enhancement
Ideas for improvements of existing features and rules.
Comments
marcelofabri
added
the
enhancement
Ideas for improvements of existing features and rules.
label
Jul 26, 2022
marcelofabri
added a commit
that referenced
this issue
Sep 4, 2022
marcelofabri
added a commit
that referenced
this issue
Sep 4, 2022
I also suggest to define an exception when the for clause and/or the if condition are pretty long and rewriting the code using |
marcelofabri
added a commit
that referenced
this issue
Oct 16, 2022
marcelofabri
added a commit
that referenced
this issue
Oct 16, 2022
marcelofabri
added a commit
that referenced
this issue
Oct 16, 2022
marcelofabri
added a commit
that referenced
this issue
Oct 21, 2022
@marcelofabri
I am curious that is there another scenario you need |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New Issue Checklist
While updating our code base to use SwiftLint 0.48.0, I realized
for_where
is now triggering for some cases where it wasn't before. It's great to fix false positives, but it made me realize that this rule might not be always wanted.In several places of our app, we use an
if
inside afor
to test if any object in a given array meets a condition. Some examples:While we could update them to use
where
, I kind of feel like it's against the spirit of the rule and it makes code harder to read:Instead, the rule could have a configuration like
allow_single_return
to not trigger a violation if the only statement inside theif
is areturn
statement.The text was updated successfully, but these errors were encountered: