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

Cop idea: first(...) instead of all(...)[0] #115

Closed
ydah opened this issue Apr 2, 2024 · 3 comments · Fixed by #118
Closed

Cop idea: first(...) instead of all(...)[0] #115

ydah opened this issue Apr 2, 2024 · 3 comments · Fixed by #118
Labels

Comments

@ydah
Copy link
Member

ydah commented Apr 2, 2024

https://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FFinders:first

# bad
all('td')[0]

# good
first('td')
@ydah ydah added the cop label Apr 2, 2024
ydah added a commit that referenced this issue Apr 11, 2024
ydah added a commit that referenced this issue Apr 11, 2024
@boris-petrov
Copy link
Contributor

I just came to open an issue about that. 😄

By the way, another case that could be replaced with first is find(..., match: :first). @ydah do you want me to open a new issue about that or you'll handle it here?

ydah added a commit that referenced this issue Jun 12, 2024
@ydah
Copy link
Member Author

ydah commented Jun 12, 2024

@boris-petrov Supported by #118 . If this is not a problem, I will merge it.

@boris-petrov
Copy link
Contributor

Seems great! Thanks for the quick implementation as usual! :)

ydah added a commit that referenced this issue Jun 12, 2024
@ydah ydah closed this as completed in #118 Jun 12, 2024
@ydah ydah closed this as completed in 4a00173 Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants