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

[BUG] ArgumentError within GitHub CI environment: invalid value for Integer(): "" #18

Closed
etagwerker opened this issue Nov 23, 2021 · 0 comments · Fixed by #19
Closed

Comments

@etagwerker
Copy link
Contributor

Hi @jmmastey,

Thanks for creating this gem! It has been very useful in estimating how big a Ruby/Rails application really is. I wrote a little bit about it over here: How we estimate the size of a Rails application

I wanted to incorporate it to rails_stats as a way to get both bundler and LOC stats, so I went ahead and submitted: fastruby/rails_stats#21

Unfortunately my test suite fails with this error:

  1) Error:
50
RailsStats::CodeStatistics::#to_s#test_0001_outputs useful stats for a Rails project:
51
ArgumentError: invalid value for Integer(): ""
52
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:40:in `Integer'
53
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:40:in `terminal_width'
54
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:50:in `column_widths'
55
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/printer.rb:21:in `to_s'
56
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/cli.rb:69:in `draw_stats'
57
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/bundler-stats-2.0.1/lib/bundler/stats/cli.rb:23:in `stats'
58
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
59
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
60
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
61
    /home/runner/work/rails_stats/rails_stats/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
62
    /home/runner/work/rails_stats/rails_stats/lib/rails_stats/console_formatter.rb:6:in `to_s'
63
    /home/runner/work/rails_stats/rails_stats/lib/rails_stats/code_statistics.rb:11:in `to_s'
64
    /home/runner/work/rails_stats/rails_stats/test/lib/rails_stats/code_statistics_test.rb:45:in `block (4 levels) in <top (required)>'
65

I see that in your test suite you stub the method that calls tput:

def set_term_width(width)
allow(Kernel).to receive(:"`").and_return(width)
end

I assume that is a good way to get around that issue in CI.

Would you be interested in a simple patch to this method?

Please let me know.

Thanks,
Ernesto

etagwerker added a commit to fastruby/bundler-stats that referenced this issue Nov 23, 2021
etagwerker added a commit to fastruby/bundler-stats that referenced this issue Nov 23, 2021
etagwerker added a commit to fastruby/bundler-stats that referenced this issue Nov 24, 2021
etagwerker added a commit to fastruby/rails_stats that referenced this issue Nov 25, 2021
jmmastey pushed a commit that referenced this issue Nov 27, 2021
* Add support for when tput returns an error message

* Add scenario when tput returns an error and Integer can't parse string

This fixes #18

* Adjust rescue argument to rescue StandardError when calling `tput`
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 a pull request may close this issue.

1 participant