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

FileHasher 'hash' method throwing error with Padrino Framework #478

Closed
vs37559 opened this issue May 2, 2023 · 1 comment
Closed

FileHasher 'hash' method throwing error with Padrino Framework #478

vs37559 opened this issue May 2, 2023 · 1 comment

Comments

@vs37559
Copy link
Contributor

vs37559 commented May 2, 2023

Describe the bug
When including Coverband in a Padrino(built over Sinatra) application, then it gives error about wrong number of arguments being passed into the method, however from the stack trace it seems the Ruby is trying to call some internal 'hash' method/variable which is seemingly overriden here.

Traceback (most recent call last):

23: from /Users/developer/.rvm/gems/ruby-2.7.3@project/bin/ruby_executable_hooks:22:in `<main>'
22: from /Users/developer/.rvm/gems/ruby-2.7.3@project/bin/ruby_executable_hooks:22:in `eval'
21: from /Users/developer/.rvm/gems/ruby-2.7.3@project/bin/padrino:23:in `<main>'
20: from /Users/developer/.rvm/gems/ruby-2.7.3@project/bin/padrino:23:in `load'
19: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/bin/padrino:9:in `<top (required)>'
18: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
17: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
16: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
15: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
14: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/cli/launcher.rb:25:in `start'
13: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/cli/launcher.rb:25:in `require'
12: from /Users/developer/Documents/eps/project/config/boot.rb:68:in `<top (required)>'
11: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/loader.rb:57:in `load!'
10: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/loader.rb:152:in `require_dependencies'
 9: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/loader.rb:152:in `each'
 8: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/loader.rb:154:in `block in require_dependencies'
 7: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/reloader.rb:93:in `safe_load'
 6: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/reloader/storage.rb:25:in `prepare'
 5: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/reloader/storage.rb:65:in `object_classes'
 4: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/reloader/storage.rb:65:in `each'
 3: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/reloader/storage.rb:65:in `each_object'
 2: from /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/padrino-core-0.15.3/lib/padrino-core/reloader/storage.rb:71:in `block in object_classes'
 1: from /Users/developer/.rvm/rubies/ruby-2.7.3/lib/ruby/2.7.0/set.rb:339:in `add'
 /Users/developer/.rvm/gems/ruby-2.7.3@project/gems/coverband-5.2.5/lib/coverband/utils/file_hasher.rb:8:in `hash': wrong number of arguments (given 0, expected 1) (ArgumentError)`

To Reproduce
Steps to reproduce the behavior:

  1. Create one basic application with Padrino Framework (any example app would do)
  2. Add Coverband as per Sinatra requirements (as a middleware)
  3. Try booting the server
  4. See error

Expected behavior
Server/Console should start without any errors

Libraries:

  • Ruby: 2.7.3
  • Padrino: 0.15.3
  • Sinatra: 2.2.4

Additional context
I have tried renaming the above method and the application was working as expected but I am trying to avoid maintaining a fork just for a simple rename.

Current Solution
Maintain a fork of the gem and rename the 'hash' method with 'hash_file' maybe. Application starts to work as expected.

danmayer pushed a commit that referenced this issue May 10, 2023
@danmayer
Copy link
Owner

OK, applied this change @vs37559 note that you are running 2.7.3 and I am dropping Ruby 2.7.x in the next coverband release... so you might still need a fork if you aren't upgrading your Ruby version soon.

8d2eb0f

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

No branches or pull requests

2 participants