Tool Detects Duplicate Code by Running Functions, Not Reading Them
A developer tool called 'assay' identifies duplicate functions by executing them against a fixed set of inputs and comparing output vectors, rather than scanning source text or names. Two functions are flagged as potential duplicates only when their outcome sequences match exactly, turning discovery into a hash-bucket operation instead of a manual or quadratic comparison. The approach uncovered a real-world pair — 'is_wordy' and '_word' — that no name-based or textual tool would have linked, differing by just one character predicate. To avoid false positives, the tool guards against trivially agreeing functions, such as those that always raise the same error, return a constant, or merely copy their input. The tool is available for both Python and JavaScript via 'pip install assay-checks' and 'npm install -g assay-checks' respectively.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in