如果我的代码库从错误的地方导入函数,我该如何继续让Semgrep检查?例如在我的django项目中:
from gettext import gettext,但我们真的应该使用from django.utils.translation import gettext
关于如何使用semgrep实现这一点有什么想法吗?
发布于 2021-06-12 06:56:39
这是你想要的吗?这里有一个实时的示例链接:https://semgrep.dev/s/0n0w
rules:
- id: import-from-wrong-module
patterns:
- pattern: |
from $X import gettext
- pattern-not: |
from my.special.module import gettext
message: Please import gettext from my.special.module
severity: ERRORhttps://stackoverflow.com/questions/67884471
复制相似问题