Add an example ast-grep rule (sg scan resources/test/cpython/)

This commit is contained in:
Charlie Marsh 2022-11-07 14:50:43 -05:00
parent de6435f41d
commit b9a119d335
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,6 @@
import os.path
import ospath
from os import path
import some as sum import some as sum
from some import other as int from some import other as int

10
rules/no-os.yml Normal file
View File

@ -0,0 +1,10 @@
id: C001
message: Don't import os
severity: warning
language: Python
rule:
any:
- pattern: import os
- pattern: import os.$_
- pattern: from os import $_
- pattern: from os.$_ import $_

2
sgconfig.yml Normal file
View File

@ -0,0 +1,2 @@
ruleDirs:
- rules