Is there a tool to lint Python based on the Google

2019-04-03 17:46发布

According to Google's standard for Python:

http://google-styleguide.googlecode.com/svn/trunk/pyguide.html

Perhaps a group of tools that can cover most of the standard?

2条回答
等我变得足够好
2楼-- · 2019-04-03 18:29

You can find the pylint.rc files used by Google's projects on github, such as the following two:

It seems that different projects could use differently customized pylint configuration files, although most of the configurations are the same.

You can further customize the pylintrc files based on these Google published pylint.rc files.

To get a complete pylint report with the score, use command:

pylint --rcfile=<path to google pylintrc> <your.py>
查看更多
男人必须洒脱
3楼-- · 2019-04-03 18:48

pylint will do this kind of checking but you need a configuration file to make it look for things exactly as Google's style guide dictates.

Google publishes this pylink file as part of various projects.

https://www.chromium.org/chromium-os/python-style-guidelines#TOC-pylint

The rc file itself is here:

https://github.com/vinitkumar/googlecl/blob/master/googlecl-pylint.rc

Copy it to /path/to/pylintrc and run pylint on your files:

pylint -E --rcfile=/path/to/pylintrc file.py file2.py
查看更多
登录 后发表回答