-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add configuration for modules to exclude for alias lifting #140
Conversation
e08b80f
to
9014a05
Compare
9014a05
to
776a881
Compare
lib/style/module_directives.ex
Outdated
Enum.reduce(aliases, @stdlib, fn | ||
Enum.reduce(aliases, MapSet.union(@stdlib, excluded_by_config), fn |
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.
Do you think it would be worth pre-calculating this when Styler first initializes and putting it in persistent_term
so that it only needs to be calculated once, since it won't vary over the course of a single formatter run?
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.
ooooooo i was sad about calculating it every time, but hadn't thought to globally cache it via persistent_term! that's a beaut. could do that with the whole config so that you don't have to pass it down thru context, oo la la
@@ -179,6 +179,19 @@ defmodule Styler.Style.ModuleDirectives.AliasLiftingTest do | |||
end | |||
|
|||
describe "it doesn't lift" do | |||
test "collisions with configured modules" do | |||
Styler.Config.set!(alias_lifting_exclude: ~w(C)a) |
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.
@GregMefford lmk if you have an idea for clean config setting per test. i had it built into assert_style and honestly could still do that. maybe smart to just add a set_config
in style_case that does the on_exit(fn -> set!([]) end)
...
merging this as-is for now since main's pretty |
Closes #139
works like
todos