mirror of https://github.com/astral-sh/ruff
Add an example ast-grep rule (sg scan resources/test/cpython/)
This commit is contained in:
parent
de6435f41d
commit
b9a119d335
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 $_
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
ruleDirs:
|
||||||
|
- rules
|
||||||
Loading…
Reference in New Issue