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

How to suppress parser/current warnings? #1819

Closed
firedev opened this issue Apr 22, 2015 · 15 comments
Closed

How to suppress parser/current warnings? #1819

firedev opened this issue Apr 22, 2015 · 15 comments

Comments

@firedev
Copy link

firedev commented Apr 22, 2015

When I run rubocop I get something like this on top:

warning: parser/current is loading parser/ruby21, which recognizes
warning: 2.1.6-compliant syntax, but you are running 2.1.2.

Is there a way to suppress that? It breaks Syntastic for Vim.

I can't change ruby version. There are other people working on this project and the version is locked.

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 22, 2015

You can't. It comes from the parser gem. /cc @whitequark

So many people have complained about this message that I'm starting to think it's more trouble that it's worth.

@firedev
Copy link
Author

firedev commented Apr 22, 2015

I think it would made sense if it was displayed with --verbose or --debug

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 22, 2015

As I said - it's not in RuboCop - we can suppress the output, but I don't want to do this, as we might end up suppressing something useful.

@whitequark
Copy link

2.1.2 and 2.1.6 genuinely differ in syntax.

If you want to complain to someone, complain to the Ruby MRI authors, who consider these changes between patchlevels acceptable.

I will not change parser.

@bbatsov bbatsov closed this as completed Apr 22, 2015
@firedev
Copy link
Author

firedev commented Apr 23, 2015

Err... Okay. So how do I force Rubocop to not complaint about that?

@whitequark
Copy link

Run Rubocop as, for example, ruby -W0 -S rubocop args....

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 23, 2015

Keep in mind this will kill all the warnings, not just this one.

@firedev
Copy link
Author

firedev commented May 14, 2015

Thanks @whitequark I just deleted the warnings.

@ioquatix
Copy link

@whitequark if I can get some kind of unofficial guarantee that the Ruby core team won't break syntax in patch releases going forward, can we remove the warning?

@whitequark
Copy link

@ioquatix I'm not sure why you mean by "unofficial". If the Ruby core team publicly commits to not changing syntax in patch releases (which will doubtlessly benefit the entire ecosystem) I am of course fine with removing the warning, since there would be no reason to have it anymore.

@ioquatix
Copy link

@whitequark I don't know what's possible yet, and I don't know at what level we could make the guarantee, ideally it would never happen, but I need to investigate further, e.g. why it happened in the past. I guess I'm just looking at options to try and help mitigate the need for the warning.

@whitequark
Copy link

@ioquatix I think that is an excellent initiative and I look forward to your results.

@westonganger
Copy link

westonganger commented Jan 28, 2021

For anyone else coming here looking for an easy solution without updating their Ruby version. Just use the warning gem to suppress the output.

# config/initializers/warning_ignores.rb

### https://github.com/jeremyevans/ruby-warning

Warning.ignore(/warning: parser/)

@marcandre
Copy link
Contributor

If I'm not mistaken, you should simply always use the latest parser gem and the latest Ruby. They are normally in sync.

@vizcay
Copy link

vizcay commented Jul 20, 2021

For anyone else coming here looking for an easy solution without updating their Ruby version. Just use the warning gem to suppress the output.

# config/initializers/warning_ignores.rb

### https://github.com/jeremyevans/ruby-warning

Warning.ignore(/warning: parser/)

@westonganger This allows to silence the warning starting rails server, etc. But not when just running rubocop.. or I'm missing something?

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

7 participants