Can Linters Tell Whether Code Was Written by AI or a Human?
Asked by
Historian
Have code-analysis tools reached the point where they can reliably distinguish AI-generated code from code written by a person? If not, is that technically possible? I realize some implementations may be nearly identical, but I'm wondering whether AI-generated code tends to have consistent patterns or habits that could reveal its origin.
Answers
There is no dependable way to distinguish human-written code from AI-generated code based on the code alone. AI systems may produce recurring patterns, such as predictable structure or overused design choices, but humans can write in those styles too. Any detector would also give the model feedback that could be used to make future output look more human.
Reply to this answer
Some people notice that generated examples favor familiar, easy-to-explain patterns, including approaches like singletons. That can be a useful clue about the source of an answer, but it is not proof: human developers use the same patterns, and models can also be prompted or trained to avoid them.
Reply to this answer
A linter is not designed to identify who or what wrote code. It checks things like syntax, style, potential bugs, and rule violations. A separate detector could look for statistical patterns, but generated code could be rewritten or lightly edited to avoid those signals, making reliable detection very difficult.
Reply to this answer
Add your answer
Answers are reviewed before publication.
bracket M10: That means detection would likely become an ongoing arms race rather than a permanent solution. Without something like verifiable authorship records or watermarking, confidence would remain limited.