Overview | Semgrep (original) (raw)

Writing rules

Tutorial

If you want the best introduction to writing Semgrep rules, use the interactive, example-based Semgrep rule tutorial.

Do it live​

Write and share rules directly from the Playground. You can also write rules in your terminal and run them with the Semgrep command line tool.

You can write rules that:

This rule detects the use of is when comparing Python strings. is checks reference equality, not value equality, and can exhibit nondeterministic behavior.

Next steps

The following articles guide you through rule writing basics or can provide you with needed references:

Looking for ideas on what rules to write? See Rule ideas for common use cases and prompts to help you start writing rules from scratch.