Feature: Source Code & Script Analysis (Reviving Tree-sitter Integration)#2931
Feature: Source Code & Script Analysis (Reviving Tree-sitter Integration)#2931EdoardoAllegrini wants to merge 6 commits intomandiant:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is an excellent and substantial contribution, reviving and modernizing the tree-sitter integration for source code analysis. The shift to pre-compiled wheels is a major improvement for usability and portability. The overall architecture is well-designed, with clear separation of concerns between parsing, feature extraction, and language-specific logic. The new feature is well-integrated into capa's existing framework.
I've found a couple of critical bugs in the Python language toolkit that need to be addressed, along with a performance issue related to regex compilation and a minor data quality issue in the C# signatures. My detailed comments provide suggestions for fixing these.
Overall, this is a fantastic piece of work that significantly expands capa's capabilities.
Revives and supersedes old PR mandiant#1080. Resolves merge conflicts and brings up to date with current master.
f317e9e to
c821399
Compare
Description
This PR introduces the ability for
capato analyze source code and scripted languages (Python, JavaScript, C#, HTML, etc.).This revives the foundational work done by @adamstorek in PR #1080. That PR was stalled primarily due to the brittleness of manually compiling C-bindings across different operating systems.
I have fully rebased the original feature onto the current
masterand entirely overhauled the underlying Tree-sitter architecture to use modern, pre-compiled OS-native PyPI wheels.Key Upgrades since #1080:
Language.build_library()to pre-compiled native wheels (tree-sitter-python,tree-sitter-c-sharp, etc.).pip install.capafeature extraction engine.GSoC Context & Next Steps
This PR also serves as the foundational technical contribution for my Google Summer of Code application. By unblocking the Tree-sitter integration now, my proposed GSoC project can focus entirely on expanding the language support, optimizing the extraction performance, and writing comprehensive rule sets for these new scripted environments. I welcome any feedback from the maintainers/mentors (e.g., @mike-hunhoff) on this implementation!
Fixes #1092
Supersedes #1080