-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Run common checks for every single solution; Add common check for snake_case #102
Conversation
This reverts commit 3243405.
af7e6f7
to
2b5b3a7
Compare
@jiegillet your review would also be much appreciated! |
end | ||
|
||
defp to_snake_case(name) do | ||
# Macro.underscore is good enough because a module attribute name must be a valid Elixir identifier anyway |
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.
100% agree, despite the warning on the function not to use, I see it used everywhere in non-core code :P
if names == [] do | ||
[] | ||
else | ||
wrong_name = | ||
names | ||
|> Enum.reverse() | ||
|> hd() | ||
|> to_string() |
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.
Same simplification could be done here
lib/elixir_analyzer/exercise_test/common_checks/function_names.ex
Outdated
Show resolved
Hide resolved
Co-authored-by: Tim Austin <[email protected]>
I'll merge to see it in action and add more checks in new PR(s) |
This is my attempt at adding common checks that will be done on every single solution, as suggested in #97
For starters, I'm adding two checks that were pretty easy to implement:
I can also see that it should be relatively easy to implement a check for PascalCase module names. It might be a bit more difficult to check for snake_case variable names, but still worth it.
I would also want to later add a check for not using tabs for indentation, but only as a
informative
comment not to be too annoying.Some checks can be "stolen" from Credo :)
@impl ModuleName
instead of@impl true
: https://github.com/rrrene/credo/blob/master/lib/credo/check/readability/impl_true.exWebsite copy PR: exercism/website-copy#2019