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

Supress warnings during parsing #1013

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Earlopain
Copy link
Contributor

@Earlopain Earlopain commented May 17, 2024

User input can contain arbitrary regexes.
Something like Parser::CurrentRuby.parse("/[\177\01\1778]/") shows a warning:

character class has duplicated range: /[\x7f\x01\x7f8]/

I'm interested in getting the warning count in the RuboCop test suite down and since it has a few regex cops there are quite a few warnings of that kind as well. They are unactionable, RuboCop instead emulates these warnings by inspecting the ast parsing the regexp with the regexp_parser gem.


Also noticed the same for floats:
Parser::CurrentRuby.parse("9.9999e999")

Float 9.9999e999 out of range

User input can contain arbitrary regexes.
Something like `Parser::CurrentRuby.parse("/[\177\01\1778]/")` shows a warning:
> character class has duplicated range: /[\x7f\x01\x7f8]/
`Parser::CurrentRuby.parse("9.9999e999")`
> Float 9.9999e999 out of range
@Earlopain Earlopain changed the title Supress warnings during regexp creation Supress warnings during parsing May 17, 2024
@iliabylich
Copy link
Collaborator

@koic Does it look good for you? I'm not sure if these warnings are a part of some implicit contract that other libraries might rely on. If not I believe we should merge it.

@Earlopain
Copy link
Contributor Author

I've ignored these warnings in RuboCop itself so this is not strictly necessary. If you feel there is some risk associated here then feel free to close (though it would be nice not having to ignore these warnings)

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

Successfully merging this pull request may close these issues.

2 participants