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 profile to rebar3 for erlang #1560
Conversation
Or is there a better solution? @joedevivo @tsloughter |
And I need some help with the travis errors, which I don't understand. |
So this uses the test profile only if the file being modified is in a test directory? |
Only if the file being modified is in a directory named "test" rather. My question is then: does Erlang/rebar forces to name your test directory "test", or are you free to name it something else? |
rebar3 defaults to looking in "test" and Erlang convention is "test". I don't know that I've seen a different directory used before. The only thing is this won't technically catch all modification of test code because some put unit tests directly in the module being tested with macros: -ifdef(TEST).
... unit tests...
-endif.
|
And there's no way to run the |
I do think the only difference for rebar (when profile is test) is to define TEST macro and compile files (including files in test dir) but Tristan knows this better, I'm just guessing here. |
Why I'm asking is that the usual way we would provide the functionality of this PR would be through a new variable The advantage of using a variable instead of the The downside is that you would need to write and publish a separate extension, just for a very simple function, which seems a bit silly. If you feel that there is no valid use case for customizing the behavior of the |
Hmm, thinking about what you wrote, why can't we always run with the 'test' profile?
|
That is what I thought this PR was at first. I'm not sure it is a good default. Maybe most people will want it that way, either way if it is default or not it should be easily configurable. |
Then in that case we can more simply have a configurable variable for the profile to use, with |
Eh, I like the use of test profile if you are in the test directory. It should be configurable for those who want to always use the test profile, for instance if they include tests in modules directly. |
Okay so we want the profile to be user-configurable, and if the user doesn't say anything, we look at the directory like this PR does right now. @dgud Can you add a Sounds good? |
Yup, that'd be great. |
Yeah I can try, give me a couple of days, I've been sick so it will take a while until I caught up with things. |
@dgud No pressure; please take time to recover. This PR isn't going anywhere ;) |
Some questions, are there more profiles we should support or are they user defined 'prod'/'native' @tsloughter ? What should package-version be? And please review my lisp code and comments I'm not fluent in either language :-) |
|
flycheck.el
Outdated
(symbol-name flycheck-erlang-rebar3-profile)) | ||
((and buffer-file-name | ||
(string= "test" (file-name-base (directory-file-name | ||
(file-name-directory buffer-file-name))))) |
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.
You want to line feed after "test"
and reindent in order to pass the make check
test.
Thanks for the changes. You'll need to document the new option in the manual as well to pass the CI. Add a |
That was the question to @tsloughter ? |
Yes indeed. If we do want more profiles then we may want to use strings instead for the option, and allow for an arbitrary |
@fmdkdd that could be useful, yea, good idea. |
Changed to arbitrary strings. |
LGTM. Please add a line to |
793dff4
to
5ac1096
Compare
To be able to compile test files profile needs to be set to "test", with the "default" profile test files are not compiled. Test files are found in the application "test" sub-directory.
5ac1096
to
02ca36f
Compare
Added line to Changes, squashed commits and rebased to master. |
Nice work! Thank you. 👏 |
To be able to compile test files profile needs to be set to "test",
with the "default" profile test files are not compiled.
Test files are found in the application "test" sub-directory.