-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Warn on unnecessary quotes #7838
Conversation
f4a3225
to
f07f955
Compare
Also, should it be |
lib/elixir/lib/code.ex
Outdated
@@ -650,6 +650,10 @@ defmodule Code do | |||
when non-existing atoms are found by the tokenizer. | |||
Defaults to `false`. | |||
|
|||
* `:warn_on_unnecessary_quotes` - when `false`, does not warn | |||
when atoms, keywords and calls have unnecessary quotes on | |||
them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a dot at the end and the default value to keep consistency with previous descriptions.
:warn_on_unnecessary_quotes
- whenfalse
, does not warn when atoms, keywords and calls have unnecessary quotes on them. Defaults totrue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe use "or" instead of "and"?
does not warn when atoms, keywords or calls have unnecessary quotes on them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the feature and I also think warn_on_unnecessary_quotes
is better.
lib/elixir/lib/code.ex
Outdated
@@ -650,6 +650,10 @@ defmodule Code do | |||
when non-existing atoms are found by the tokenizer. | |||
Defaults to `false`. | |||
|
|||
* `:warn_on_unnecessary_quotes` - when `false`, does not warn | |||
when atoms, keywords or calls have unnecessary quotes on | |||
them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the documentation about the default value is handy :)
I just want to be sure that part was not overlooked from my previous comments. If you disagree, no worries :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed it. :) Tks for double checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
❤️ 💚 💙 💛 💜 |
I've been looking at barrel-db/rebar3_elixir_compile#37 and noticed that you no longer use Code.eval_string in Mix.Dep.Lock. From this I assume that it is intentional that you cannot turn off the warning when using Code.eval_string? So the rebar3 plugin should to the same thing? |
Yes, the rebar3 plugin should do the same. The options given to eval are not forwarded to string_to_quoted but you can just call it directly and put it all together. This approach should also be backwards compatibility. |
Closes #7634