我正在虚拟环境下使用^{
直接运行pylint时,我得到以下输出
$ pylint src/**/*.py
************* Module main
src/main.py:1:0: C0114: Missing module docstring (missing-module-docstring)
src/main.py:3:0: C0116: Missing function or method docstring (missing-function-docstring)
------------------------------------------------------------------
Your code has been rated at 5.00/10 (previous run: 5.00/10, +0.00)
当相同的命令包装在bash脚本中时,执行bash脚本会产生不同的输出
$ $SHELL --version | head -n 1
GNU bash, version 5.0.18(1)-release (x86_64-apple-darwin19.5.0)
$ which $SHELL
/usr/local/bin/bash
$ cat lint.sh
#!/usr/local/bin/bash
pylint *.py src/**/*.py
$ ./lint.sh
************* Module src/**/*.py
src/**/*.py:1:0: F0001: No module named src/**/*.py (fatal)
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
如果lint.sh
和src
目录位于同一(根)目录中,则lint.sh
中的src/**/*.py
是正确的
下面是有关执行环境的更多信息
$ pylint --version
pylint 2.6.0
astroid 2.4.2
Python 3.8.5 (default, Aug 9 2020, 16:57:39)
[Clang 12.0.0 (clang-1200.0.26.2)]
您正在脚本中使用
**
。需要激活此功能:很可能,它是在交互式shell中启用的,这就是它在那里工作的原因。您可以通过执行以下操作来查询其设置:
相关问题 更多 >
编程相关推荐