Closed paulstatezny closed 2 years ago
Actually, there's a complicating factor.
The files that only
, except
, and app_lib_except
filter are both the ones in lib/foo
and test/foo
.
So if the user wasn't supposed to specify the lib/foo/
prefix, how would they differentiate between a path in lib
and an identical path in test
?
It's an edge case for sure since most files in lib
will typically end in .ex
and most files in test
will end in _test.exs
. But what if you happened to have something like this:
+ lib
+ my_app
- authorization.ex
+ test
+ my_app
- authorization.ex
Imagine that the file in lib
performs authorization tasks for the app, and the file in test
includes test setup code for the app.
Perhaps this would be even more peculiar because the modules in these files would have a naming conflict if the developer followed typical community conventions. (They'd both by called MyApp.Authorization
.)
But it still feels a bit too ambiguous for me from a clarity standpoint.
Imagine a structure like this:
+ lib
+ my_lib
- auth.ex
+ test
+ my_lib
- auth_helper.ex
With the change suggested by this issue, the user would say:
lib :my_lib do
only [
"auth.ex",
"auth_helper.ex"
]
end
By looking just at the only
invocation, it's not fully clear whether auth.ex
is in lib
or test
.
For this reason, we should probably keep the behavior as-is.
Current Behavior
As you can see in the Setting up a Phoenix project guide, every string you pass to the only and except options as well as the app_lib_except callback will always start with
lib/my_app_or_lib
wheremy_app_or_lib
is whatever the directory in lib is.For example:
It's pretty redundant.
Suggested Behavior
Would it be nicer DX if we auto-prepended the
lib/foo/
behind the scenes? So that the user would enter this instead: