-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metavariable Type Extension for Semgrep Rule Syntax #8119
Comments
This issue is synced in Linear at https://linear.app/semgrep/issue/PA-2884/metavariable-type-extension-for-semgrep-rule-syntax. Note: this link is for r2c use only and is not accessible publicly. |
What's the purpose of this issue? Just so it could be referenced in the PR? |
Exactly 😄
|
Support metavariable-type field for Python. Context: #8119 PR checklist: - [ ] Purpose of the code is [evident to future readers](https://semgrep.dev/docs/contributing/contributing-code/#explaining-code) - [ ] Tests included or PR comment includes a reproducible test plan - [ ] Documentation is up-to-date - [ ] A changelog entry was [added to changelog.d](https://semgrep.dev/docs/contributing/contributing-code/#adding-a-changelog-entry) for any user-facing change - [ ] Change has no security implications (otherwise, ping security team) If you're unsure about any of this, please see: - [Contribution guidelines](https://semgrep.dev/docs/contributing/contributing-code)! - [One of the more specific guides located here](https://semgrep.dev/docs/contributing/contributing/)
This issue proposes a dedicated field for annotating the type information of metavariables. By adopting this approach, instead of relying solely on language-specific casting syntax, we provide an additional way to enhance the overall usability by eliminating the need to write redundant type cast expressions for a single metavariable.
Moreover, the new syntax brings other benefits, including improved support for target languages that lack built-in casting syntax. It also promotes a unified approach to expressing type, pattern, and regex constraints for metavariables, resulting in improved consistency across rule definitions.
Current syntax:
Proposed syntax:
The text was updated successfully, but these errors were encountered: