-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Handle encoding error from the parser gem #289
Conversation
Errors in prism are due to the same reason that rubocop/rubocop#12822 was made. |
Temporarily resolved in #290. Can you rebase with the latest master branch? |
CHANGELOG.md
Outdated
@@ -2,6 +2,8 @@ | |||
|
|||
## master (unreleased) | |||
|
|||
* [#289](https://github.com/rubocop/rubocop-ast/pull/289): Fix an error during parsing when encountering unknown encodings in the encoding magic comment. ([@Earlopain][]) |
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.
Can you add an changelog entry file instead?
https://github.com/rubocop/rubocop-ast/blob/master/CONTRIBUTING.md#changelog-entry-format
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.
Yeah, sure. I looked like this one isn't done here. I added a .gitkeep
file to the changelog folder to make it more clear, like in the RuboCop repo.
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.
I added a
.gitkeep
file to the changelog folder to make it more clear, like in the RuboCop repo.
Can you separate the commit as they serve different purposes? It's also fine to send a separate PR.
This specific exception has been added only in the most recent release. Previously it threw an `ArgumentError`.
0699b97
to
16a4012
Compare
This may be of interest to you. I openend ruby/prism#2741 to align it with the parser gem. Raising a syntax error for bare yields etc. breaks extensions like |
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.
Good job, thanks
Released in 1.31.3 |
The first run would be fine but after loading rubocop would error. This is for the same reasons as rubocop/rubocop-ast#289 Instead of rescuing the exception, delay buffer creation until it is first needed. This will prevent the error when all offenses are global.
The first run would be fine but after loading rubocop would error. This is for the same reasons as rubocop/rubocop-ast#289 Instead of rescuing the exception, delay buffer creation until it is first needed. This will prevent the error when all offenses are global.
This specific exception has been added only in the most recent release. Previously it threw an
ArgumentError
. PR in parser: whitequark/parser#999This is not really a syntax error: Running a file with an encoding like that produces the following output:
RuboCop will report it as one though, since it will pick up the error from
parser_error
. I don't believe it is worth it to add extra logic to make a distinction here.