-
Notifications
You must be signed in to change notification settings - Fork 459
don't collect records without an action #959
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
Conversation
|
One example is the base API controller in Foreman: https://github.com/theforeman/foreman/blob/fc4b4544804ced8cb52bfc40e9b54c092dedc698/app/controllers/api/base_controller.rb#L56-L61 The resulting |
caaab6c to
b3a7e8d
Compare
|
the rubocop failures are unrelated, so are the Ruby 3.4 ones. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, are there any another cases where the action might be nil? 🤔
|
I have (luckily?) not enough knowledge about Rails to answer this. |
|
Code looks good, but on mobile and I'd like to have a closer look on my desktop |
sometimes the collector gets called with `:action => nil`, e.g. when the
originating request failed and Rails returned an error *before*
identifying which action would have been executed.
this breaks the writer with the following error:
/home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/application.rb:234:in `block in get_method_descriptions': undefined method `to_sym' for nil:NilClass (NoMethodError)
Did you mean? to_m
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/application.rb:233:in `map'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/application.rb:233:in `get_method_descriptions'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/apipie_module.rb:34:in `method_missing'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:175:in `block (2 levels) in load_new_examples'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:174:in `map'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:174:in `block in load_new_examples'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:171:in `each'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:171:in `reduce'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:171:in `load_new_examples'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:134:in `merge_old_new_examples'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor/writer.rb:77:in `write_examples'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor.rb:81:in `write_examples'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor.rb:49:in `finish'
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/apipie-rails-1.4.2/lib/apipie/extractor.rb:182:in `block in <top (required)>'
/home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/minitest-5.25.5/lib/minitest.rb:83:in `exit': exit (SystemExit)
from /home/runner/work/foreman/foreman/vendor/bundle/ruby/2.7.0/gems/minitest-5.25.5/lib/minitest.rb:83:in `block (2 levels) in autorun'
While we could guard the writer from this problem, it doesn't really
make sense to collect these calls anyway, as the data in there won't be
usable.
b3a7e8d to
f7d8d88
Compare
sometimes the collector gets called with
:action => nil, e.g. when the originating request failed and Rails returned an error before identifying which action would have been executed.this breaks the writer with the following error:
While we could guard the writer from this problem, it doesn't really make sense to collect these calls anyway, as the data in there won't be usable.