Tutorials

Create Pattern Rules

Next

Get Started

In this tutorial, you will learn how to create pattern rules. A pattern ruleset lets you catch a pattern of code and emits violations/errors.

Objectives

You are going to write an analysis rule that

  1. Detects assert foo and replaces with assert bar
  2. Pass any check on a test file

To make a rule, we need to go through the following steps:

  1. Create a ruleset
  2. Create a rule
  3. Write the rule
  4. Add some tests

All the code in the rules is written in

JavaScript

This is a pattern rule for

Python

Click next at the top for a walkthrough step by step.

Codiga Logo
Codiga Hub
  • Rulesets
  • Playground
  • Snippets
  • Cookbooks
soc-2 icon

We are SOC-2 Compliance Certified

G2 high performer medal

Codiga – All rights reserved 2022.