# Should I include code or a link to a test project for the code being reviewed?

I have some code (a library) of about 25,000 characters (~1000 lines) that I would like to have reviewed.

I have a test project (Windows project with Windows Forms) for that code. Is it a good idea to give a link to this code?

If it's a good idea, where should I put that code? That code can change and should not be reviewed.

• Do you have it on GitHub? If so, you can link to a specific "snapshot" in the tree - that way the link will always point to the same version of the code. Aug 9 '15 at 21:11
• Aug 9 '15 at 21:24
• Aug 9 '15 at 21:25
• @nhgrif, thanks for the links Aug 9 '15 at 21:29

25K characters is a large post, but it's well below the maximum of 30K so there should be more than enough room to supply enough plain-English context and "walk" the reader through the code.

You can link to the test code for context; I've linked to the code base at a specific commit on GitHub myself, for additional context - the code that's linked to isn't up for review though, but that's exactly what you're saying you want to do here.

Not all code posted in a question is always up for review.

Questions frequently include context code that isn't intended to be reviewed, and the best way to indicate that the code you're providing isn't meant to be part of the review is by using quote blocks like this:

>     func fooBar() -> String {
>         return "fooBar"
>     }


This doesn't show up quite so great on meta, as the code and quote blocks appear to have the same background. On the main site, it puts a yellow-ish background behind the gray code block. We take this as a sign that the code is provided as context only and not intended to be reviewed.

I'd highly recommend taking this approach, as it puts all of the necessary information all on one page.

• problem is since the test project is a windows form, the code is more than 50,000 characters, not possible to post it in the question Aug 9 '15 at 21:20
• Well, I'd recommend reconsidering posting it all as one big chunk. meta.codereview.stackexchange.com/questions/2436/… Aug 9 '15 at 21:21

You cannot link to the code as an alternative to posting the code in your question. The code that you want reviewed must be embedded in the question. We actually have a close reason specifically for questions that do not contain any code. Links can rot and your question would be of no value to the community if that happened.

I was once told that if the code was too large to be posted here, that was a critique in and of itself. I believe this is true. If you have that much code in a single form, then you likely have some work to do prior to getting it reviewed. Extract some methods and classes before getting it reviewed. If that's not possible, then try to focus in on some particularly gnarly chunk of it that you're having trouble with.

However, if you just want to provide some extra context for the code to be reviewed, external links to other code is perfectly acceptable. We would still have the code under review here.

• this question was to make sure this one was following the guide line; codereview.stackexchange.com/questions/100434/… Aug 10 '15 at 13:28
• @Fredou question looks good to me. The meta was just a bit vague. Wanted to make sure it was clear that the question had to have code. Aug 10 '15 at 14:54