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
The commented code is considered for code validatation rather than just comment! #15134
Comments
@Saif-Shines Yes, we are aware of this as an existing issue on the main website, and we do lack the infrastructure to have a strict parser if you may. The only way currently would be to move forth by deleting the comments. |
Potential contributors, this needs to be investigated around here: /cc @BerkeleyTrue |
On the very first challenge of Basic Javascript I ran into a similar issue while trying to comment: // Use comments only when they are actually needed
/* Sometimes, using descriptive names for variables and functions is way better
than leaving code smell all over your code */ In this case, because in my second comment I use the word "function", would throw: Maybe running tests for |
Cannot we do something like : |
I would like to take on this. |
I am intrested in this issue can this be assigned to me and can you direct me to the files that need to be changed. |
Since there is no update on this in more than a week, I'll take this up. Hope it's okay with you guys @Survivor75 and @knrt10 @raisedadead : I believe the solution is way simpler than we have been thinking. We run assertions on For example in -
Instead of directly passing in the code as it is, I'd run a regex to get rid of comments like
When done this way the test runner never receives the comments in code and all is good. I've validated this regex here - http://regexr.com/3ghvi NOTE:
|
@adityaparab its cool 👍 . This will strip out any commented code :) |
Unfortunately the only real solution here is to use AST's for tests. I've discussed this with @QuincyLarson about adding in an API that exposes the JS AST produced by babel and add an API similar to eslint's plugin interface. This may be a bit off as priority is to move on the react challenges and then generalize the way challenges themselves are imported from files. |
I just ran into this issue with comments containing the word "function"... I got really confused until someone one the forums explained what was going on. Hope this issue gets fixed soon! Perhaps there should be some message displayed to users warning them about the parser issues regarding comments in the challenges? See also: |
@SuperGeniusZeb Thanks for reporting this, and confirming the steps to reproduce it. |
I'm closing this issue as stale since it hasn't been active lately. If you think this is still relevant to the newly updated platform, please explain why, then reopen it. |
In the updated site, comments are still being mistakenly read as code by the challenge tests. Take this challenge for example: Using the following code, I can pass the test (which checks for
Please re-open this issue. |
@SuperGeniusZeb Can you please open a new issue at https://github.com/freeCodeCamp/learn/issues ? Thanks a lot. |
@raisedadead I have just created a new issue there: |
[Using Objects for lookup]
link for the challenge:
https://www.freecodecamp.com/challenges/using-objects-for-lookups
Issue Description
In this challenge, I had to produce object version of switch statements. As I had to remember each 'case' member of switch to produce an object version, I had commented out the whole switch part and retyped the correct object version.
Though, I haven't able to pass the test.
This is due to test check of
You should not use case, switch, or if statements
During commenting out the switch, it should not validate the usage of switch and consider it just as a comment.
Browser Information
Your Code
Screenshot
The text was updated successfully, but these errors were encountered: