Create AST Rules


7. Ignore test files

First, we will pass the analysis if the file is a test file. We will skip the analysis if the file starts with test_ or ends with _test.py.

Therefore, we add the following code at the beginning of the visit function. This code exists the visit function if the test matches the patterns in the condition.

1if (filename.includes("_test.py") || filename.includes("test_")) { 
2    return;

Let's go!

Start interacting with the tutorial!


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.