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

Style rules for the seqbind transform #413

Closed
gnuvince opened this issue Oct 31, 2016 · 7 comments
Closed

Style rules for the seqbind transform #413

gnuvince opened this issue Oct 31, 2016 · 7 comments

Comments

@gnuvince
Copy link

The seqbind parser transform allows Erlang code to reuse the "same" variable name multiple times:

X@ = 10,
X@ = X@ + 1.

Though useful sometimes, its usage is typically a code smell. I have created two new style rules (gnuvince/elvis_core#1):

  • The no_seqbind rule warns when a module declares its intention to use seqbind (-compile({parse_transform, seqbind}).);
  • The no_useless_seqbind rule warns when a module has activates the seqbind transform, yet never makes any use of it (i.e., no Var@ names anywhere in the module).
@elbrujohalcon
Copy link
Member

@gnuvince just curious: where do you get that parse_transform from?
I haven't seen anything like that in my ~10 years as an Erlanger. 😱

@gnuvince
Copy link
Author

@elbrujohalcon It's an option for the compiler: http://erlang.org/doc/man/compile.html (scroll down a few screenfuls).

@elbrujohalcon
Copy link
Member

I know what parse_transform is ;). I was asking where did you get this one (seqbind) in particular.

@gnuvince
Copy link
Author

Oops, misread, sorry! Here's their Github repo: https://github.com/spawngrid/seqbind

@elbrujohalcon
Copy link
Member

Thanks. Please send a PR over with your rules, then :)

@gnuvince
Copy link
Author

PR submitted: inaka/elvis_core#67

The gadget/compiler check failed, but I'm not sure what the problem is.

@DBoroujerdi
Copy link

DBoroujerdi commented Nov 22, 2016

@gnuvince I commented on issue #418 about failed tests but I hadn't seen this issue. It's related to this seqbind merge and could be the cause of the gadget/compiler check you mention.

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

3 participants