I have a python project contains python files within the parent directory and even in its children directory. I want to analyze all the python files within the directory. However I do not want to specify the name of folders. Is there a way which will help me out. The hierarchy may vary but the script should still work. Thank You.
答案 0 :(得分:1)
If you are looking for a shell script which will go over the files and run lint:
for file in /Project/*; do
if [ -d $file ]; then
for subfile in $file/*; do
if [[ $subfile == *.py ]]; then
pylint $subfile
fi
done
fi
if [[ $file == *.py ]]; then
pylint $file
fi
done
答案 1 :(得分:1)
如果您的项目是合适的python package(即基本上为__init__.py
的文件夹),您只需运行pylint packagename
。