jaredbeck / libyear-bundler

A simple measure of dependency freshness
GNU Lesser General Public License v3.0
102 stars 7 forks source link

Inaccurate libyears total for a Rails application #27

Closed etagwerker closed 3 months ago

etagwerker commented 8 months ago

Hi there,

First of all, thank you for creating and maintaining this gem!

Secondly, I think I found an issue with the total sum of libyears for a pretty regular Rails application. It may be related to https://github.com/jaredbeck/libyear-bundler/issues/11

This application is using Rails 6.1.7.2 which is 0.8 libyears behind:

➜  points git:(master) ✗ libyear-bundler --all Gemfile
                   actioncable        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                 actionmailbox        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                  actionmailer        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                    actionpack        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                    actiontext        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                    actionview        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                     activejob        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                   activemodel        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                  activerecord        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                 activestorage        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                 activesupport        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                      bootsnap         1.17.0     2023-10-30         1.17.1     2024-01-12         1      [0, 0, 1]       0.2
                    capistrano         2.14.2     2013-02-07         3.18.0     2023-10-18        64      [1, 0, 0]      10.7
               climate_control          0.2.0     2017-05-12          1.2.0     2022-07-15         5      [1, 0, 0]       5.2
                         faker          3.2.2     2023-11-03          3.2.3     2024-01-13         1      [0, 0, 1]       0.2
                   http-accept          1.7.0     2017-03-14          2.2.0     2022-08-02         3      [1, 0, 0]       5.4
             letter_opener_web          1.4.1     2021-10-06          2.0.0     2021-11-06         3      [1, 0, 0]       0.1
                      minitest         5.20.0     2023-09-06         5.21.1     2024-01-12         2      [0, 1, 0]       0.4
                        parser        3.2.2.4     2023-10-04        3.3.0.3     2024-01-12         4      [0, 1, 0]       0.3
                          rack          2.2.8     2023-07-31          3.0.8     2023-06-14        14      [1, 0, 0]       0.0
                         rails        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                      railties        6.1.7.2     2023-01-25          7.1.2     2023-11-10        35      [1, 0, 0]       0.8
                           rbs          2.8.4     2023-01-20          3.4.1     2023-12-26        24      [1, 0, 0]       0.9
          standard-performance          1.3.0     2023-12-26          1.3.1     2024-01-10         1      [0, 0, 1]       0.0
                      terrapin          0.6.0     2018-02-02          1.0.1     2023-11-15         2      [1, 0, 0]       5.8
                 will_paginate          3.3.1     2021-08-12          4.0.0     2023-05-29         1      [1, 0, 0]       1.8
                          ruby          3.0.4                         3.3.0                       11      [0, 3, 0]       0.0
System is 41.2 libyears behind
Total releases behind: 591
Major, minor, patch versions behind: 21, 5, 3

So I would expect libyears to say that rails is 0.8 libyears behind and that's that.

But then it says that it's 0.8 * + 0.8 (rails) behind.

So then it ends up being 0.8 * 11 + 0.8 (rails) behind which wrongly reports that it is in total 9.6 libyears behind...

Would it make sense to try to fix this?

jaredbeck commented 8 months ago

Hi Ernesto, glad you got some use out of it!

So then it ends up being 0.8 * 11 + 0.8 (rails) behind ..

If I understand your arithmetic, you are referring to the fact that rails is composed of 11 gems (activerecord, activejob, etc.)

One of the main goals of the "libyear" metric is to be simple. We must be able to explain it quickly to our colleagues. If we begin adding special rules for certain gems, it loses that property of simplicity. So, I don't want to change the default calculation.

However, I'd be open to adding a CLI option, like --compact 'rails=activerecord,activejob'. Something like --compact 'rails' would be insufficient, because we don't want to "compact" the entire sub-tree. For example, most people will want nokogiri listed separately. I'm open to suggestions on the format, but it should be a generalized feature, not rails-specific. --coalesce would be another good word for this.

Perhaps a simpler design would be --ignore 'activerecord,activejob'.

etagwerker commented 8 months ago

@jaredbeck Thanks for the quick response! I agree with your train of thought there and I really like this idea:

Perhaps a simpler design would be --ignore 'activerecord,activejob'.

It's simple and flexible enough so that anybody can pick and choose which gems they care about. In my case, I would ignore all the active* and action* components included in rails.

I could work on this option and submit a PR for it.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale due to inactivity. The resources of our volunteers are limited. Bug reports must provide a script that reproduces the bug, using our template. Feature suggestions must include a promise to build the feature yourself. Thank you for all your contributions.