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

#188: implement calculate average hoc and number of files changed in recent merged PRs #285

Merged
merged 1 commit into from
Aug 18, 2024

Conversation

Yegorov
Copy link
Contributor

@Yegorov Yegorov commented Aug 15, 2024

@yegor256 Merge zerocracy/fbe#70 PR before

@Yegorov
Copy link
Contributor Author

Yegorov commented Aug 15, 2024

@Suban05 can you review it, please? (Test fail, because this zerocracy/fbe#70 PR need merge before)

Copy link
Contributor

@Suban05 Suban05 left a comment

Choose a reason for hiding this comment

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

@Yegorov It looks good, but I have a small question

Comment on lines 112 to 113
f.average_pull_hoc_size = hocs.empty? ? 0 : hocs.inject(&:+).to_f / hocs.size
f.average_pull_files_size = files.empty? ? 0 : files.inject(&:+).to_f / files.size
Copy link
Contributor

Choose a reason for hiding this comment

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

@Yegorov can we write it in a simpler way?
like this:

Suggested change
f.average_pull_hoc_size = hocs.empty? ? 0 : hocs.inject(&:+).to_f / hocs.size
f.average_pull_files_size = files.empty? ? 0 : files.inject(&:+).to_f / files.size
f.average_pull_hoc_size = hocs.sum / hocs.size.to_f
f.average_pull_files_size = files.sum / files.size.to_f

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Suban05 I think not, because if hocs is empty, we will get an answer NaN

3.3.4 :002 > 0 / 0.to_f
 => NaN

The same thing for files

Copy link
Contributor

@Suban05 Suban05 Aug 15, 2024

Choose a reason for hiding this comment

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

@Yegorov yes, indeed, you're right. what do you think about replacing hocs.inject(&:+) with hocs.sum?
like this:

hocs.empty? ? 0 : hocs.sum / hocs.size

Copy link
Contributor Author

@Yegorov Yegorov Aug 15, 2024

Choose a reason for hiding this comment

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

@Suban05 Yes, it has become more readable, thanks!

Copy link
Contributor

@Suban05 Suban05 left a comment

Choose a reason for hiding this comment

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

@Yegorov looks good

@yegor256
Copy link
Member

@Yegorov what's up with this one? Good to merge? Please, read this: https://www.yegor256.com/2024/04/01/ping-me-please.html

@Yegorov
Copy link
Contributor Author

Yegorov commented Aug 18, 2024

@yegor256 yes of course, merge this PR.

@yegor256 yegor256 merged commit 163ca31 into zerocracy:master Aug 18, 2024
8 checks passed
@yegor256
Copy link
Member

@Yegorov thanks!

@Suban05
Copy link
Contributor

Suban05 commented Aug 18, 2024

@Yegorov Next time please always write in the description of a pull request something like this: Closes #issue_id or maybe Fixes #issue_id. This way, the issues are closed automatically, and we don't have to ask @yegor256 to close issues :)

@0crat
Copy link

0crat commented Aug 18, 2024

@Suban05 Thank you for your code review! We appreciate your contribution. As per our policy, you've earned +5 points: +10 base points, -10 for having fewer than 6 comments (only 4 were made), and +5 to meet the minimum reward. While we encourage more detailed reviews in the future, your effort is valued. Your current balance stands at +443. Keep up the good work!

@0crat
Copy link

0crat commented Aug 18, 2024

@Yegorov Hey there, awesome job on your contribution! 🎉 You've scored a cool 30 points: 15 for showing up, and another 15 for those 159 hits-of-code you cranked out. That's a sweet spot - not too much to trigger deductions, but enough to max out your code bonus. Keep the momentum going and aim for that perfect balance between quantity and quality. Your total now stands at an impressive +401. Rock on and keep those contributions flowing!

@Yegorov
Copy link
Contributor Author

Yegorov commented Aug 18, 2024

@Suban05 ok thanks for the advice!

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.

4 participants