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 positive: The condition of if should not be wrapped in parentheses #461

Closed
jueberschlag opened this issue Oct 9, 2017 · 1 comment

Comments

@jueberschlag
Copy link

Environment

  • Credo version (mix credo -v): 0.8.6
  • Erlang/Elixir version (elixir -v): 1.5.1
  • Operating system: Ubuntu

What were you trying to do?

I tried to use Bitwise operators in if condition

defmodule Example do
	@moduledoc false
	import Bitwise

	def bar(foo, bar) do
		if (foo &&& 0b1000) > 0, do: bar, else: nil
	end

	def foobar(foo) do
		foo
	end
end

Expected outcome

No Code Reliability warning

Actual outcome

The condition of `if` should not be wrapped in parentheses

Something strange also: the warning disappear if the function containing the if-Bitwise operation is the last functions of the module.

@rrrene
Copy link
Owner

rrrene commented Nov 4, 2017

Thanks for reporting this 😀 It is now fixed on master.

You can try this by setting the Credo dep to

{:credo, github: "rrrene/credo"}

Please report back if your issue is solved! 👍

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

2 participants