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

New for_loop_index_linter #1629

Merged
merged 3 commits into from
Oct 7, 2022
Merged

New for_loop_index_linter #1629

merged 3 commits into from
Oct 7, 2022

Conversation

MichaelChirico
Copy link
Collaborator

Part of #884

This one is not violated often in our experience, but it's quite bad when it is.

x <- 1:10
for (x in x) x
x
# [1] 10

Seems like undesirable behavior.

IndrajeetPatil
IndrajeetPatil previously approved these changes Oct 7, 2022
Copy link
Collaborator

@IndrajeetPatil IndrajeetPatil left a comment

Choose a reason for hiding this comment

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

LGTM.

The only nitpick I have is using `for()` instead of for in the docs and message. But don't feel strongly about it.

@MichaelChirico
Copy link
Collaborator Author

"for loop" is a much more general programming construct, for() doesn't look right to me. I'll keep it as is. Thanks!

@IndrajeetPatil
Copy link
Collaborator

Sure, but I find it easier to parse the following

This is true for for() loops.

over this

This is true for for loops.

@IndrajeetPatil IndrajeetPatil self-requested a review October 7, 2022 09:05
@MichaelChirico
Copy link
Collaborator Author

Sure, I would disambiguate with "for for loops", but that's not used here anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants