Apipie / apipie-rails

Ruby on Rails API documentation tool
Apache License 2.0
2.47k stars 460 forks source link

Getting So many Warnings while using apipie with Ruby 2.7.7 #835

Closed nitinsingh25 closed 1 year ago

nitinsingh25 commented 1 year ago

Recently I have upgraded my ruby version to ruby 2.7.7 and now I can see too much of warning related to this gems in my test execution log:

instance variable not initialized

lib/apipie/dsl_definition.rb:350: warning: instance variable @_current_param_group not initialized
lib/apipie/param_description.rb:104: warning: instance variable @from_concern not initialized
lib/apipie/dsl_definition.rb:12: warning: instance variable @_apipie_dsl_data not initialized
lib/apipie/application.rb:255: warning: instance variable @recorded_examples not initialized

Am I missing something? Or is it already reported?

nitinsingh25 commented 1 year ago

@mathieujobin Please check these warnings are creating chaos in my current application. Is there any plan to fix those?

mathieujobin commented 1 year ago

Thanks a lot for reporting.

What version are you using?

I am wondering if it isn't one of the recent refactor by @PanosCodes ?

Easiest would be to compare a few versions to find out.

I am mostly using ruby 3 everywhere. But I had never noticed those.

Thanks again

nitinsingh25 commented 1 year ago

I am using ruby 2.7.7 & rails 5.2.4.1 with latest apipie gem.

nitinsingh25 commented 1 year ago

raised this PR - https://github.com/Apipie/apipie-rails/pull/836

PanosCodes commented 1 year ago

Thanks a lot for reporting.

What version are you using?

I am wondering if it isn't one of the recent refactor by @PanosCodes ?

Easiest would be to compare a few versions to find out.

I am mostly using ruby 3 everywhere. But I had never noticed those.

Thanks again

It seems unlikely, but I'll look into it 👀

PanosCodes commented 1 year ago

In orders to expose these warnings you need to run ruby in verbose warning level(2) ex RUBYOPT=-W2 rails test and from what I see they do not seem to be relevant to any recent merges (checked with v0.8.0 tag and are present there too)

nitinsingh25 commented 1 year ago

In orders to expose these warnings you need to run ruby in verbose warning level(2) ex RUBYOPT=-W2 rails test and from what I see they do not seem to be relevant to any recent merges (checked with v0.8.0 tag and are present there too)

Yes Try to run test cases with $VERBOSE=true.

mathieujobin commented 1 year ago

Thanks for looking into it @PanosCodes, I didn't have anytime until now. they seems pretty harmless. I agree warnings can be pretty annoying. I don't have this verbose flag on myself...

@nitinsingh25 Can you try if this branch fix your issue?

https://github.com/Apipie/apipie-rails/pull/838

I have not tested it, only modified the code.

Thanks

nitinsingh25 commented 1 year ago

@mathieujobin Thank you for your quick response. I have tested my changes with #838 and added comment there. Can we quickly fix all these warnings and quickly release next patch version? This will be super helpful & reduce ~21K lines of warnings in my project due to this gem only.

nitinsingh25 commented 1 year ago

@mathieujobin Any update on above?

mathieujobin commented 1 year ago

Those warning are gone with ruby 3.0 and 3.1

and 2.7 goes EOL at the end of the month... I'd say its not worth fixing...

nitinsingh25 commented 1 year ago

Those warning are gone with ruby 3.0 and 3.1

and 2.7 goes EOL at the end of the month... I'd say its not worth fixing...

Okay. Let me find out some other way to silent this gem specific warnings in my application because Ruby 3 upgrade is not in our pipeline as of now. We are just upgrading to ruby 2.7 only.

mathieujobin commented 1 year ago

you can use my branch I made for #838, or cherry-pick the changes... but I'm not ready to release those changes just yet...

mathieujobin commented 1 year ago

closed by mistake, I don't mind keeping it open

mathieujobin commented 1 year ago

I changed my mind, I suggest you switch to $VERBOSE=false until you can upgrade to ruby 3.0