如何解决为什么 mypy 检查我排除的文件?
我正在尝试为项目设置 mypy 类型检查。我想排除一堆文件/目录来启动,这样我们至少可以强制执行新代码的类型检查,然后我们可以随着时间的推移销毁排除列表。不幸的是,mypy 忽略了我的排除配置,我不知道为什么。
[mypy]
python_version = 3.8
exclude = /examples/
但是当我运行 mypy --verbose .
时,它仍然会发现该目录中的文件并出现错误。日志消息告诉我它正在查看我的排除配置,但显然忽略了它:
LOG: Mypy Version: 0.812
LOG: Config File: mypy.ini
LOG: Configured Executable: /Library/Developer/CommandLinetools/usr/bin/python
3
LOG: Current Executable: /Library/Developer/CommandLinetools/usr/bin/python
3
LOG: Cache Dir: .mypy_cache
LOG: Compiled: True
LOG: Exclude: /examples/
<snipped>
LOG: Found source: BuildSource(path='./examples/fib.py',module='fib',has_text=False,base_dir='/Users/user/a/examples')
LOG: Found source: BuildSource(path='./examples/fib_iter.py',module='fib_iter',base_dir='/Users/user/a/examples')
<snipped>
examples/fib.py: error: Duplicate module named 'fib' (also at './examples/a/fib.py')
examples/fib.py: note: Are you missing an __init__.py? Alternatively,consider using --exclude to avoid checking one of them.
Found 1 error in 1 file (errors prevented further checking)
为什么我的排除配置不起作用?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。