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

[Feature Request] Warn on expressions that contain logical operators but no braces #313

Open
m-o-e opened this issue Nov 30, 2022 · 0 comments

Comments

@m-o-e
Copy link

m-o-e commented Nov 30, 2022

A pretty mean (and probably common) trap:

$ cat >test.cr <<EOC
foo = ["batz"]

if foo.includes? "bar" || foo.includes? "batz"
  puts "this code is bug-free"
end
EOC
$ crystal test.cr
(no output)
$ ameba test.cr

Inspecting 1 file

.

Finished in 2.21 milliseconds
1 inspected, 0 failures

Can easily go unnoticed even with test-coverage.
I think it would be great if ameba would warn about it.

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

No branches or pull requests

2 participants