Comments (5)
So thanks for the report. Unfortunately, I would say the problem is in your code.
From my testing, this (your code) is not valid ruby code:
render 'devise/shared/error_messages', resource:
f.hidden_field :reset_password_token
Try it in a file and try to run rubocop
or even just plain ruby
on it. Same error.
Or try it in an irb console (with a def, so that it's all treated at once):
def foo
render 'devise/shared/error_messages', resource:
f.hidden_field :reset_password_token
end
It will get refused. The code might work in HAML, and in the previous version of haml-lint. But that's just an unintended side-effect of how the code is processed (HAML adds lots of parentheses and HAML-lint used to process line by line).
It feels weird to use the shortcut of not specifying a variable without having parentheses around the call. It really feels ambiguous if the result of the next line should be used or the default variable. And this error is proof that it's ambiguous.
Your solution is to put parentheses: render('devise/shared/error_messages', resource:)
Regards,
from haml-lint.
Are you sure resource:
has no arguments after it? What is the expected behavior when the value is omitted? Treat as nil
?
from haml-lint.
It's a shortcut to using the variable/method with the same name. Like in JS.
I forgot this issue. I'm looking into it now.
from haml-lint.
Going to close as a question that has been answered. Thanks!
from haml-lint.
@MaxLap Thank you for such a detailed answer and the solution to my problem.
You're right, it's really feeling a bit weird to use such shorthand syntax without parentheses. Somehow I didn't ponder over it before...
from haml-lint.
Related Issues (20)
- NoMethodError when running haml lint on file HOT 5
- Lint/Syntax: unexpected token tPIPE after upgrade to 0.46.0 HOT 6
- The hash shorthand syntax not working? HOT 2
- RuboCop: Lint/Syntax: unexpected token tEQ error when line starts with the `==` HOT 2
- Trailing Empty lines linter is missing (compared to slim-lint)
- Multiline pipes do not work when inside interpolation HOT 1
- Multiline pipes in JS files cause RuboCop to report "unexpected token tRCURLY"
- Haml-lint is running rubocop to lint JavaScript regex HOT 1
- False positive Rails/HttpStatus HOT 2
- Failing spec on main branch HOT 2
- Add support to Haml 6.2
- `haml-lint:disable` is ignored when line breaks on commas are present
- Add `-s`/`--stdin` option support HOT 2
- Allow Haml 6.3 HOT 3
- Haml 6.2 actions are not listed among required checks HOT 1
- Failing spec on main (local environment, up to date rubocop)
- Issue with Rubocop `Layout/IndentationConsistency` interaction with haml comment blocks HOT 2
- Version 0.53.0 has not been pushed to Rubygems HOT 1
- 0.54.0: Too many files open HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haml-lint.