Creative Commons has spent a while trying to pin down what counts as "commercial use" for art and data, but they'll tell you flat out that code is out of scope. Ideas like "dependencies" or "linking" are not considered by CC licenses.
Furthermore, they spent maybe close to a decade wrangling with trying to better nail down NC and, as far as I can see, basically punted. Anything unambiguously NC is mostly something that you’d hopefully never see an issue around anyway, e.g. making a print of a photo for your house. Everything else, someone will argue is commercial even if it’s not an unambiguous commercial use like an ad.
That's a good point. It seems about right that license terms are all about the cases where the code is used "commercially", for some sense of "commercial". If the code is never used commercially, there's never a reason to enforce the license.
Maybe the most effective non-commercial code license is the most popular license on GitHub: the null license.
(If someone's about to reply "You can't just use code you found on GitHub without a license, you can get into all kinds of trouble that way", that's exactly my point about using code with a "non-commercial" license.)
Creative Commons has spent a while trying to pin down what counts as "commercial use" for art and data, but they'll tell you flat out that code is out of scope. Ideas like "dependencies" or "linking" are not considered by CC licenses.