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

Incorrect Lint/EmptyExpression: Avoid empty expression #169

Closed
jwoertink opened this issue Oct 23, 2020 · 6 comments
Closed

Incorrect Lint/EmptyExpression: Avoid empty expression #169

jwoertink opened this issue Oct 23, 2020 · 6 comments
Labels

Comments

@jwoertink
Copy link

After the recent commit 44290a6 I pulled in the master branch to test, and now I get 4 failures for Lint/EmptyExpression from in my comments:

src/avram/callbacks.cr:183:42
[W] Lint/EmptyExpression: Avoid empty expression d t
> # > back the record may not be persisted to the database.
                                         ^
src/avram/callbacks.cr:218:29
[W] Lint/EmptyExpression: Avoid empty expression t b
> # > back the record may not be persisted to the database.
                            ^
src/avram/callbacks.cr:218:51
[W] Lint/EmptyExpression: Avoid empty expression dat
> # > back the record may not be persisted to the database.
                                                  ^
src/avram/callbacks.cr:219:18
[W] Lint/EmptyExpression: Avoid empty expression  `a
> # > Instead use `after_commit`
                 ^
Finished in 936.4 milliseconds

You'll see that first one says line 183. Here's a screenshot of that block
Screen Shot 2020-10-23 at 8 55 06 AM

And the other ones on 218 and 219 are essentially the same comments.
Screen Shot 2020-10-23 at 8 56 46 AM

@veelenga
Copy link
Member

Wow, looking! Sorry about that 😕

@jwoertink
Copy link
Author

no worries! Thanks for looking in to it ❤️

@veelenga
Copy link
Member

veelenga commented Oct 23, 2020

src/avram/callbacks.cr:183:42
src/avram/callbacks.cr:183:44
src/avram/callbacks.cr:218:29
src/avram/callbacks.cr:218:31
src/avram/callbacks.cr:218:51
src/avram/callbacks.cr:218:53
src/avram/callbacks.cr:219:18
src/avram/callbacks.cr:219:20

https://github.com/luckyframework/avram/blob/fe7e79d5cc0673215303f50e1fb97627584b7f79/src/avram/callbacks.cr#L183

https://github.com/luckyframework/avram/blob/fe7e79d5cc0673215303f50e1fb97627584b7f79/src/avram/callbacks.cr#L184

https://github.com/luckyframework/avram/blob/fe7e79d5cc0673215303f50e1fb97627584b7f79/src/avram/callbacks.cr#L218

https://github.com/luckyframework/avram/blob/fe7e79d5cc0673215303f50e1fb97627584b7f79/src/avram/callbacks.cr#L219

This is the file location crystal's compiler points for NilLiteral. There is definitely a bug in the compiler I am going to report. For now, I will disable this particular rule Lint/EmptyExpression since it highly relies on the location of the AST node and there is no way to filter out the incorrect results.

@jwoertink
Copy link
Author

@veelenga do we still need to open an issue on crystal?

@veelenga
Copy link
Member

veelenga commented Oct 26, 2020

@jwoertink yeap, I will do in a bit. Does this block you somehow?

@jwoertink
Copy link
Author

Cool. Nope, I'm good on my end 😄 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants