-
-
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
Universal checks for every single solution? #97
Comments
I like this idea in moderation. The casing stuff I think is important enough to warrant extensions. The indenting, I would rather point people to |
We could create a mix format microservice (picoservice?) which accepts a chunk of code and "formats it" and returns it to the editor :P |
In which way would you point people? From the context I'm guessing NOT by having an analyzer comment? Would you expect mentors to tell students that?
That would be great because students in the web editor otherwise won't have access to the auto formatting :D but I have a hunch it wouldn't be part of v3.0... Now that the base work for having common checks is in there, I'm going to create separate tickets for separate checks so that other people can work on them too. |
How about adding checks for |
If this were to be implemented, I would suggest to it be informational at most since there might be a specific reason they left it in. (Partial optimized solution in order to elicit/engage mentor feedback, etc) |
Good point. I once had a weird process-related bug that depended on a |
@jiegillet I would be fine with an informational comment telling the student to try to remove usages of https://github.com/exercism/elixir/blob/main/exercises/concept/rpg-character-sheet/.meta/exemplar.ex |
|
There's a check for two-fer for those but not much else. Using |
Re-reading the thread, I think the idea was to add a common check that runs |
I felt comfortable telling everyone about Could there be a way of only showing this comment if the formatting differences are... "big enough" (very specific term, I know :D)? |
You're right, it made sense for the CLI, not for the web editor. Another idea I had was coming back to the compiler warnings. I revisited an older solution that a mentor commented on because I had a compiler warning. Now there aren't any ways to get to those warnings on the web editor. If there was a way to get compiler warnings in the analyzer, we could show |
I thought of a new check. Quite a few times when mentoring I saw code like this: cond do
something? -> :a
true -> :b
end I think we could suggest to use I have another one, but it' more of a personal preference. Sometimes I see code with arguments piped into a single function like this |
IMO both are too subjective for me to feel comfortable adding them to the analyzer. I agree with you that most two-clause cases should be Something different that might be more objective is the
|
OMG yes, that's just plain wrong :) |
I would disagree with adding this check, it assumes that |
If I think the contrived example is x = if a or b, do: true, else: false |
How about a check that suggests |
Too subjective IMO, and yes, I say that mostly because I never use |
An idea for a global check came up: when there's only one function clause with a body, and student additionally specified a "top" function head (e.g. to add a default argument), suggest that they can merge it with the only function clause. E.g. def add_player(scores, name, score \\ @initial_score)
def add_player(scores, name, score) do
Map.put(scores, name, score)
end could be def add_player(scores, name, score \\ @initial_score) do
Map.put(scores, name, score)
end Or there could be a macro to specify checks that accept both formats, like in https://github.com/exercism/elixir-analyzer/pull/234/files |
As I mentor, I keep seeing some reoccurring problems with solutions that are exercise-independent and could, at least partially, be detected automatically.
A code snippet from a real recent solution:
The analyzer could detect and give a suggestion to the user that:
@spec
for a function should be placed directly above that function definition, there shouldn't be a different function definition in betweenMore opinionated, but we could also check if each public function has a
@spec
and@doc
and nudge students to add them (for practice exercises only).Without parsing the AST, we could check if the code is intended with spaces or with tabs.
I think in particular the camelCase and indenting are worth doing in the analyzer, because they're hard no-nos in community Elixir code, but they're annoying details that are pretty uncomfortable to point out to a new comer. It would be nicer if a machine did that 🙂.
The text was updated successfully, but these errors were encountered: