GitHub introduced a private beta version of GitHub Copilot with an enhanced filter. This filter identifies and presents contextual code suggestions related to public code on GitHub.
With the filter activated, GitHub Copilot assesses code suggestions alongside approximately 150 characters of neighboring code. It then cross-references these suggestions with an index of all public code on GitHub.com.
The matched suggestions, along with details about the repositories they originate from, are exhibited directly in the code editor. Developers now possess the option to either prevent suggestions containing corresponding code or permit these suggestions while receiving information about the matches.
According to prior research by GitHub, matches in GitHub Copilot suggestions are infrequent, accounting for less than one percent. However, this occurrence is not uniformly spread across all scenarios. Matches are rarely observed within the context of an established application alongside existing code. In contrast, matches are more frequent in situations where the file is empty or has minimal content.
A code fragment that appears in many repositories is more likely to be a “pattern” detected by the model—similar to the patterns we see elsewhere in public code. Also, repositories with matching code are often governed by multiple, sometimes conflicting licenses, which makes attributing a match to its source more challenging, Ryan J. Salva, VP of pProduct at GitHub, wrote in a blog post.
By consulting a list of references developers can now make informed decisions about attribution, content, and origin instead of immediately blocking matches, gain insights by studying how other developers have tackled similar issues, and more.