-
-
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
Add high-score
analysis
#72
Conversation
feature "uses the module attribute in add_player function head" do | ||
find :any | ||
type :essential | ||
suppress_if "uses the module attribute in add_player function body", :pass | ||
comment ElixirAnalyzer.Constants.high_score_use_module_attribute() | ||
|
||
form do | ||
def add_player(_ignore, _ignore, _ignore \\ @_ignore) do | ||
_ignore | ||
end | ||
end | ||
end | ||
|
||
assert_call "uses the module attribute in add_player function body" do | ||
type :essential | ||
suppress_if "uses the module attribute in add_player function head", :pass | ||
comment ElixirAnalyzer.Constants.high_score_use_module_attribute() | ||
calling_fn module: HighScore, name: :add_player | ||
called_fn name: :@ | ||
end |
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.
@neenjaw I am stuck with this part. I want to allow the student to either use the module attribute in the function's head as a default argument, or in the function's body in any way that they want. I don't want to have false positives if they use the attribute in the body in a roundabout way (e.g. x = @initial_score; Map.put(scores, name, x), that's why I'm trying to use
assert_callfor this instead of
feature`.
This means that I need a cyclic dependency with suppress_if
, and that doesn't work. Do you have any thoughts on if it's possible to modify the analyzer to allow cyclic dependencies with suppress_if
?
Alternatively, I can give up on the idea of allowing usage of the module attribute in the function body and instead add a new check that will tell students to use a function head with default arguments.
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.
Hmm, haven't thought about that. Let me ponder this case
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.
@neenjaw if you have no ideas, then I'm just going to disallow the usage of the module attribute in the function body by adding some analysis that checks that a default argument was used.
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.
Just haven't had time to work on this, but that's a good stopgap for now
I've been playing around with the website, exercise flow the last week and I think it makes me a lot more hesitant in our application of This is probably a bit of a backtrack in my opinion from a previous stance -- but like I said, I am not sure any more whether we should use Thoughts? Like I've said before, I'm not keen on trying to stop "cheaters" since I don't think they are here for the right reasons anyways, and so it seems futile to expend energy on those students when could redirect that energy to helping interested/engaged ones more. |
I agree that I have been too careless in using the
To avoid this, I think we should only use
Otherwise, any comment that suggest an improvement should be For Pacman Rules, I would rephrase the current comment to even be a
If you already have the tests passing and you only need to change one detail, this feedback loop will hopefully be fast enough. But maybe in production the tests runners will be much slower because of the load of all of the users 🙁. As for the general attitude toward analysis. In my opinion, the main target of analysis is to unburden mentors, and this is achieved by two ways: pointing out obvious problems automatically, so that the mentor doesn't have to (like: reuse functions, use default arguments etc.), and ensure that students learning the concepts actually "learned" them so that the mentor later on doesn't have to fill big gaps in their knowledge. I also don't think the goal is to prevent cheaters in the sense of people with bad intentions. I think most people that "cheat" (in the sense do not follow the rules) skimmed the instructions instead of reading them carefully so they are not fully aware, and/or operate on autopilot when approaching "easy" coding tasks, which leads them to do things the way they know from language X instead of the Elixir way. I think it's worth having |
I agree if this is a minor change, but I think it may be that a suggestion leads to having to change your design/implementation. I think this is good for now, but maybe we can think of a way to measure this to monitor it and adjust our approach later when students start to interact with the system on a larger scale |
add_player
so that module attribute usage is possiblesuppress_if
toassert_[no_]call
macros_shallow_ignore
that only ignores the current node in the AST, but continues matching on the node's children. This was necessary to be able to match a module attribute with any name, but with a specific value because:feature
that show the difference between_ignore
and_shallow_ignore
Website copy PR: exercism/website-copy#2013