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

Resolve new chefstyle warnings & use safe navigators #1507

Merged
merged 4 commits into from Sep 8, 2020
Merged

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Sep 8, 2020

We can avoid some duplicate checks by using &. in places

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50 tas50 requested review from a team as code owners September 8, 2020 17:41
r.merge(dev: i) if r[:family] == family[:name]
end.compact
end
end&.compact
Copy link
Contributor

@phiggins phiggins Sep 8, 2020

Choose a reason for hiding this comment

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

I think it'd be more readable to add a next unless iv[:routes] or similar at the top of the loop instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that's probably a good case where the alternative is most likely way more readable.

Copy link
Contributor

@phiggins phiggins left a comment

Choose a reason for hiding this comment

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

I'm not a huge fan of the pretzel operator but I could just be being a curmudgeon 😅

We can avoid some duplicate checks by using &. in places

Signed-off-by: Tim Smith <tsmith@chef.io>
@lamont-granquist
Copy link
Contributor

(I kinda like the pretzel-dot operator, but some of these use cases are a bit funny)

There's no need for the &. here

Signed-off-by: Tim Smith <tsmith@chef.io>
Also add some notes here that we should convert this to a filter_map
when we can as that's easier to read and faster.

Perf benchmarks from the tubes:

Signed-off-by: Tim Smith <tsmith@chef.io>
@tas50
Copy link
Contributor Author

tas50 commented Sep 8, 2020

Nuked the weird ones. We should be good now

@tas50 tas50 merged commit 0478c40 into master Sep 8, 2020
@tas50 tas50 deleted the chefstyle branch October 30, 2020 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants