My question is about sharing code in my thesis. I ran simulations using ready data in my field from a book. After that, I compared the results with those from the book. Do I need to share my code or is sharing it optional? Because I already explained the methodology that I used for my thesis. Looking forward to your answer. I tried to find a proper answer but I couldn't find it.
2 Answers
If your advisor suggests not publishing your code then it would probably be a mistake to do so. How your thesis is handled is a matter for your advisor, your committee, and the university to handle. If they are satisfied then there is no danger of "cancellation" or other problem.
After your degree is granted you can make your own decisions in the future about what to publish and what not. I'll note that you can use your thesis as the basis of future publications and update it as you see fit, properly citing it, of course.
But it is the institute and no-one else who decides about your degree.
Your institute is the one who gives you your degree, revoking it is only going to happen if there is some sort of serious academic misconduct that they find out about much later. They know at the time you submit your thesis whether or not your code is included, so there is no reason that they would give you your degree knowing this, and then later deciding it is a reason to revoke your degree.
The most important thing is that your degree needs to be approved by your advisor and committee, so if your advisor says not to include it, don't. You could always put your code up on GitHub and include a reference to it in your thesis. (My thesis included my code at the end, as an appendix; I'm pretty sure no one ever looked at it).