Skip to content

New for_loop_index_linter - #1629

Merged
MichaelChirico merged 3 commits into
mainfrom
for-loop
Oct 7, 2022
Merged

MichaelChirico merged 3 commits into
mainfrom
for-loop

Conversation

@MichaelChirico

Copy link
Copy Markdown
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

@IndrajeetPatil IndrajeetPatil left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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