Unless you are publishing a software methods paper, you don’t have to worry about cleaning the code or making it portable. In my field, publishing code (and data) is a requirement and has been for years. That doesn’t mean that the code needs to be pretty ( it usually isn’t), it just needs to support the paper.
So, yes. Please publish the code, it will make the rest of the paper stronger.
So, yes. Please publish the code, it will make the rest of the paper stronger.