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

Open
ydah opened this issue Apr 2, 2024 · 1 comment · May be fixed by #118
Open

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

ydah opened this issue Apr 2, 2024 · 1 comment · May be 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
@ydah ydah linked a pull request Apr 11, 2024 that will close this issue
11 tasks
@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?

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