rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.91k stars 416 forks source link

SpaceAroundOperators thinks -> as operator #446

Closed chulkilee closed 6 years ago

chulkilee commented 7 years ago

Environment

What were you trying to do?

Running mix credo to check files, formatted by https://github.com/whatyouhide/code_formatter

@type config_or_func :: Config.t() | (-> Config.t())

Expected outcome

No error

Actual outcome

Got "There are spaces around operators most of the time, but not here."

-> in the @type is not operator :)

rrrene commented 6 years ago

Thx for reporting! :+1:

OvermindDL1 commented 6 years ago

'Technically' ->/2 is an operator in the AST. However something like -> blah is inferred like () -> blah. The bug here is that it seems that Credo wants a space between ( and ->, which does indeed seem superfluous to me. ^.^;

rrrene commented 6 years ago

@chulkilee Thanks for reporting this 😀

@OvermindDL1 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! 👍