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

"Space around operators most of the time, but not here." Issue #52

Closed
hackling opened this issue Mar 11, 2016 · 12 comments
Closed

"Space around operators most of the time, but not here." Issue #52

hackling opened this issue Mar 11, 2016 · 12 comments
Assignees

Comments

@hackling
Copy link

┃    __ CODE IN QUESTION
┃
┃       |> Date.shift(days: n * -1)
┃                               ^
┃
┃    __ WHY IT MATTERS
┃
┃       Don't use spaces after operators like `+`, `-`, `*` and `/`. This is the
┃       **preferred** way, although other styles are possible, as long as it is
┃       applied consistently.

I do prefer space around my operators, but I do also like to have negative numbers. -20 * -13 also seems acceptable to me as well. Thoughts?

@hackling
Copy link
Author

┃    __ CODE IN QUESTION
┃
┃       fn(field)->
┃                ^^
┃
┃    __ WHY IT MATTERS
┃
┃       Don't use spaces after operators like `+`, `-`, `*` and `/`. This is the
┃       **preferred** way, although other styles are possible, as long as it is
┃       applied consistently.

Worth noting the false positive I got here....

@rrrene
Copy link
Owner

rrrene commented Mar 11, 2016

Hi Nicholas,

your first example is clearly a bug in Credo. In the second example, the help text is wrong 😞 my bad!

Will investigate and fix soon!

@rrrene rrrene self-assigned this Mar 11, 2016
@rrrene
Copy link
Owner

rrrene commented Mar 11, 2016

And thx for reporting! 👍

rrrene added a commit that referenced this issue Mar 11, 2016
@rrrene rrrene closed this as completed in 34796c1 Mar 11, 2016
rrrene added a commit that referenced this issue Mar 11, 2016
@rrrene
Copy link
Owner

rrrene commented Mar 11, 2016

v0.3.6 contains a patch for this! Thx for reporting 👍

@c-rack
Copy link
Contributor

c-rack commented Mar 12, 2016

@rrrene I have a similar false positive for this line (a simple input to integer function):
https://github.com/c-rack/cidr-elixir/blob/master/lib/cidr.ex#L196

Just checked with 0.3.6, but the "There are spaces around operators most of the time, but not here" message still appears for this line. Shall I open another issue or want you re-open this one?

@rrrene
Copy link
Owner

rrrene commented Mar 12, 2016

@Crack Please check with cough v0.3.7. 😁

@c-rack
Copy link
Contributor

c-rack commented Mar 13, 2016

Works like a charm, thanks 👍

@dylan-chong
Copy link
Contributor

dylan-chong commented Jan 2, 2018

Is the first issue mentioned supposed to be fixed?

I can still get that issue using IO.inspect -3 and assert -3 == -3

┃ [C] ↗ There are spaces around operators most of the time, but not here.

@jessejanderson
Copy link

I'm getting this error for a test where I want to assert a negative result. I'm using 0.9.0-rc1.

assert -12 == MyApp.fun_that_should_return_a_negative

@dylan-chong
Copy link
Contributor

@rrrene I just want to check that you are getting these messages.

@rrrene
Copy link
Owner

rrrene commented Mar 3, 2018

@dylan-chong 👍

@rrrene rrrene reopened this Mar 3, 2018
@rrrene
Copy link
Owner

rrrene commented Sep 16, 2018

This has been fixed for Elixir version >= 1.6.0-rc. 👍

@rrrene rrrene closed this as completed Sep 16, 2018
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

5 participants