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

False positives on Lint/UriRegexp cop #8466

Closed
wata727 opened this issue Aug 6, 2020 · 0 comments · Fixed by #8467
Closed

False positives on Lint/UriRegexp cop #8466

wata727 opened this issue Aug 6, 2020 · 0 comments · Fixed by #8467
Labels

Comments

@wata727
Copy link
Contributor

wata727 commented Aug 6, 2020

RuboCop v0.89.0 reports an offense when using regexp method, not URI.regexp. A small example is here:

def regexp
  /\A[a-z ]*\z/
end

'a' =~ regexp

Expected behavior

No offenses found

Actual behavior

Inspecting 1 file
W

Offenses:

example.rb:5:8: W: Lint/UriRegexp: URI.regexp is obsolete and should not be used. Instead, use URI::DEFAULT_PARSER.make_regexp.
'a' =~ regexp
       ^^^^^^

1 file inspected, 1 offense detected

Steps to reproduce the problem

Run rubocop against the above example code.

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:

$ [bundle exec] rubocop -V
0.89.0 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.6.6 x86_64-darwin19)
@koic koic added the bug label Aug 6, 2020
koic added a commit to koic/rubocop that referenced this issue Aug 6, 2020
Fixes rubocop#8466.

This PR fixes a false positive for `Lint/UriRegexp`
when using `regexp` method without receiver.
@koic koic closed this as completed in #8467 Aug 6, 2020
koic added a commit that referenced this issue Aug 6, 2020
[Fix #8466] Fix a false positive for `Lint/UriRegexp`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants