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

Ignore white-space after a trailing comma in a list #61

Closed
eksperimental opened this issue Apr 8, 2016 · 4 comments
Closed

Ignore white-space after a trailing comma in a list #61

eksperimental opened this issue Apr 8, 2016 · 4 comments
Assignees

Comments

@eksperimental
Copy link

I found to be good practice to leave lists to contain a trailing comma,
@options [foo: 1, bar: 2, ]
so it's implied that more elements can be added to this list,

but when running mix credo --strict I will get a warning:

[C] ↗ There is no whitespace around parentheses/brackets most of the time, but here there is.

The warning is gone when I remove the trailing white space
would it be possible to ignore the trailing space when it's presided by a comma, and just judge the list by whether it starts with a white-space or not.

thank you for creating such a beautiful tool

@eksperimental eksperimental changed the title Ignore space after a comma in a list Ignore white-space after a trailing comma in a list Apr 8, 2016
@rrrene
Copy link
Owner

rrrene commented Apr 8, 2016

Ah, did not think of this. Thanks for reporting! 👍

@rrrene rrrene self-assigned this Apr 8, 2016
rrrene added a commit that referenced this issue Apr 12, 2016
@rrrene rrrene closed this as completed in 35fef8e Apr 12, 2016
@rrrene
Copy link
Owner

rrrene commented Apr 12, 2016

@eksperimental I released a fix in v0.3.12 :shipit:

I'm not really sure if it was a good idea that [], {} and () pairs are all treated by the same check inside Credo. Your case above makes it clear that there are subtle differences in their semantics, so I think I should separate each of these into their own checks for v0.4.0.

Thoughts?

@eksperimental
Copy link
Author

thank you!

@eksperimental
Copy link
Author

I think I missed your previous comment,
I think [ ] and { } are fine to have the rule, parentesis are a special case as I cannot think a case where you would use a comma at the end.

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