Is it OK if I write a question and include a link to GitHub/Pastebin/other similar site instead of putting the code here on Code Review?
No. We require the code to be contained within the question, for the following reasons:
- To avoid dependency on third-party hosting services. These links tend to go away after a while.
- To prevent review requests of huge projects.
- To make it easier to see the code and so it can interest more reviewers and get more reviews.
- To avoid confusion when the OP changes the code in the repository and suddenly the answers no longer apply to the code.
(Some of these points have been taken from Winston Ewert's answer to another question.)
If your code is too long (doesn't fit within the 65 535 character limit for posts on Code Review), please select only the portions of the code where you are especially interested in getting reviewed. In such a case, you may add a link to a site where more of your code can be seen, but don't expect anyone here to review it.
Why other users should avoid updating questions to add in the code for you
You might think, "Why don't you just update my question and add the code from my link, instead of putting my question on hold?" We can't do this because of copyright. All code posted here must be licensed under Creative Commons Attribution-ShareAlike. As the owner of copyright in the code you have written, you are the only person who can license it. No-one else has the legal authority to do it for you.
1\$\begingroup\$ 1. GitHub is a opensource friendly, well-know, big hosting service. Unlikely to disappear. 2. That's might be true, but it's possible to point to some single files on GitHub. 3. It's at least as easy as on GitHub to discuss about code. I would say it's easier on GitHub, due you see the whole file and not just a frame. 4. GitHub uses a version control system and the author can point to a specific version, which unlikely changes. \$\endgroup\$– RobinFeb 16, 2014 at 22:21
22\$\begingroup\$ @Sam You're dead wrong. Files on GitHub are really likely to disappear, because the author simply takes it down because he no longer cares. \$\endgroup\$ Feb 17, 2014 at 17:38
\$\begingroup\$ @Sam: If you want to review code on GitHub, then do so! GitHub has an excellent system for code review. \$\endgroup\$ Feb 17, 2014 at 22:11
\$\begingroup\$ >To prevent review requests of huge projects. So what is the suggestion for the huge project? \$\endgroup\$ Jul 4, 2016 at 14:18
1\$\begingroup\$ @AnindyaChatterjee As long as it fits within one question, it is okay. For projects larger than that, post a question focusing on only a part of your code, then incorporate the suggestions you get and see if you can apply it on other parts of your code as well before you post a question about those other parts. \$\endgroup\$ Jul 5, 2016 at 7:38