英文:
PEP8 between specific lines
问题
我有一些在我的代码库中的巨大文件,其中存在许多与pep8相关的问题。
是否有办法分析与pep8相关的特定行?
pep8 input /path/to/my-code.py --lines=100-200
这样我就可以分析代码的特定部分了?
英文:
I have some huge files in my codebase which have many pep8 related issues.
Is there any way to analyze specific lines with pep8
pep8 input /path/to/my-code.py --lines=100-200
So that I can analyze specific part of the code?
答案1
得分: 1
我不认为pep8中有这个内置功能,但你可以通过将pep8与终端工具如sed结合使用来实现此目标:
sed -n '100,200p' /path/to/my-code.py | pep8 input -
在这种情况下,sed的输出(文件的第100行到第200行)被用作pep8的输入。
英文:
I don't think there is a built-in feature in pep8 for this, but you can achieve this by combining pep8 with a terminal tool such as sed:
sed -n '100,200p' /path/to/my-code.py | pep8 input -
In this case the output of sed (line 100 to line 200 of your file) is used as the input of pep8
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论