Usually when I want to give credit to a software or code that I have used I cite the paper that describes the that software or code.
Another point: if you attribute a DOI to your code, that could result in it "stealing" the citations from a paper that describe that code.