This code should not pass the test :D #7600
I agree! Although it is a very _resourceful _ way to pass the test... wouldn't be too good if the test inputs changed, though.
I don't know if we'd want to update the tests just to account for an intentional bypass.
@FreeCodeCamp/issue-moderators thoughts?
How do we want to handle code shown in the original post? Even something like this:
function palindrome(str) {
switch(str) {
case "eye":
return true;
case "race car":
return true;
case "not a palindrome":
return false;
case "A man, a plan, a canal. Panama":
return true;
case "never odd or even":
return true;
case "nope":
return false;
case "almostomla":
return false;
case "My age is 0, 0 si ega ym.":
return true;
case "1 eye for of 1 eye.":
return false;
case "0_0 (: /-\ :) 0-0":
return true;
}
}
palindrome("eye");
@sludge256 Interesting.
Thing is IMHO, if we do handle a couple of cases like this there will be a ton others similar when it comes to people intentionally wanting to pass the challenges.
And after a point it will become really tedious to manage these cases.
Why would anyone genuinely interested in solving the challenge would do as such?
Well, I do have a dirty/unfair way to avoid such scenarios:
- Add just one input test case that's not in the list (by Obfuscating it).
-
When anyone does come up with scenarios like one stated in the issue (the test fails in background), we show a modal window:
Are you sure you are doing this challenge honestly?
IDK, make the message a bit funnier.
Of course our code is Open Source and anyone can go thru the code and bypass this anyway, but definitely it would prompt most to act more honestly?
IDK, that's just my personal opinion, although I really really wouldnt want such a thing ever. I believe most of the campers and the community is dedicated to the curriculum. And this is simply not just a good way to do it for their sake.
Challenge: Word Blanks should have tests to make sure campers use function parameters #7603
There is obviously a limit to what we can do to stop attempts like this.
I would consider someone "solving" problems like this to potentially have violated out academic honesty policy. This is clearly not solving the problem as per the instructions. If I saw a "solution" like this when reviewing for a non-profit project, the camper would not be allowed to participate until they fixed it.
Challenge Check for Palindromes has an issue.
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
.Please describe how to reproduce this issue, and include links to screenshots if possible.
My code: