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

PartialInstanceVariable reports false positive for templates under folders with underscores #244

Closed
joemasilotti opened this issue Dec 8, 2021 · 3 comments

Comments

@joemasilotti
Copy link

I have a template app/views/cold_messages/new.html.erb that uses an instance variable and PartialInstanceVariable is reporting a violation.

Open source app and failing CI run here: https://github.com/joemasilotti/railsdevs.com/runs/4451151656?check_suite_focus=true

Run bundle exec erblint --lint-all
1 error(s) were found in ERB files
Linting 55 files with 16 linters...

Instance variable detected in partial.
In file: app/views/cold_messages/new.html.erb:1

Error: Process completed with exit code 1.
# app/views/cold_messages/new.html.erb
<%= render "shared/error_messages", resource: @message %>

<%# More code follows... %>

Digging into the code, it looks like the regex naively checks for an underscore to identify a partial. Is this correct, or am I misunderstanding the validator?

return unless processed_source.filename.match?(%r{(\A|.*/)_[^/\s]*\.html\.erb\z}) &&
@joemasilotti
Copy link
Author

Ah, I see that this was fixed in #235!

Any chance a release can be cut to include this bug fix?

@RubenSmit
Copy link

This issue has been fixed for a while but not included in a release yet. Any chance of a release in the nearby future?

@rafaelfranca
Copy link
Member

Released

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

3 participants