Closed angelikatyborska closed 3 years ago
Option 2 is way cooler, and I'd totally be up for implementing it :) What I'm not sure is if it's not a little to preachy as a common check, but I'll leave that up to you
What I'm not sure is if it's not a little to preachy as a common check, but I'll leave that up to you
Hmm. Maybe we should ask some of the mentors. I always tell students to make private everything that doesn't have to be public, but I wouldn't be surprised to be labelled preachy 🙃
A few voices on Slack agreed with the check.
There was also a mention about @doc false
which is a way to hide public functions from the generated documentation. This is necessary when writing a library, and you need to make a function public for your own usage between modules, but the users of your library shouldn't use it.
Alright, then if it's OK, I'll assign myself to the task. Since we need to read practice exercise solutions (now we only read concept ones), there are some things that I want to generalize.
There was also a mention about @doc false which is a way to hide public functions from the generated documentation. This is necessary when writing a library, and you need to make a function public for your own usage between modules, but the users of your library shouldn't use it.
I will add a brief explanation about that in the comment.
This kind of check is great, because learning about idiomatic use and advanced tips like this while learning the language is very useful, I think.
Desired checks
Helper function should be private
Look for all the public functions defined in the solution. There should only be one,
start/0
. Every other function should be private. This should either be an "actionable" or even "informative" comment.Implementation?
There is no helper macro for this kind of check. It would need to be a custom check directly on the AST using
check_source/check
.I'm thinking that I would want this kind of check for almost every exercise. There could be a few different ways to achieve it.
@neenjaw @jiegillet ideas, thoughts?