简介
PyChecker是一个对Python源代码进行语法检查的工具。
主页:http://pychecker.sourceforge.net
PyChecker is a static analysis tool for finding bugs in Python source code. It finds problems that are typically caught by a compiler for less dynamic languages, like C and C++. It is similar to lint.
目前最新版本是2008-08-18 更新的pychecker-0.8.18。
安装
前提:本地安装好Python2.x, 推荐2.6版本,虽然2.7版本也发布了。3.0版差异太大,相当于全新版本,不保证兼容性,不推荐使用。
最好将IPython也一并安装了。
下载地址:http://sourceforge.net/projects/pychecker/
从网页上下载pychecker-0.8.18.tar.gz,解压。
然后在pychecker-0.8.18目录(其下有setup.py脚本), 执行命令行python setup.py install 执行安装。这也是在Windows下python软件的通用安装方式。
使用
安装好后,试试在pychecker-0.8.18目录执行命令行pychecker setup.py,检查setup.py的语法
E:/pychecker-0.8.18>pychecker setup.py
E:/pychecker-0.8.18>C:/Python26/python.exe C:/Python26/Lib/site-packages/pychecker/checker.py se
tup.py
Processing module setup (setup.py)...
Warnings...
C:/Python26/lib/distutils/command/bdist_wininst.py:271: Statement appears to have no effect
C:/Python26/lib/distutils/command/build_scripts.py:80: No class attribute (dry_run) found
C:/Python26/lib/distutils/command/build_scripts.py:97: No class attribute (dry_run) found
C:/Python26/lib/distutils/command/build_scripts.py:120: (file) shadows builtin
C:/Python26/lib/distutils/command/build_scripts.py:121: No class attribute (dry_run) found
C:/Python26/lib/distutils/command/install_data.py:62: (dir) shadows builtin
C:/Python26/lib/distutils/command/install_data.py:64: (dir) shadows builtin
C:/Python26/lib/distutils/command/install_data.py:66: (dir) shadows builtin
C:/Python26/lib/distutils/command/install_scripts.py:52: (file) shadows builtin
C:/Python26/lib/distutils/command/install_scripts.py:53: No class attribute (dry_run) found
19 errors suppressed, use -#/--limit to increase the number of errors displayed
这里pychecker 是个bat脚本,实际执行的是C:/Python26/python.exe C:/Python26/Lib/site-packages/pychecker/checker.py 。
这里检查结果将setup.py依赖的文件中语法错误或告警也检查出来了。
如果只想检查setup.py自身的语法,可以用--only参数
E:/pychecker-0.8.18>pychecker --only setup.py
E:/pychecker-0.8.18>C:/Python26/python.exe C:/Python26/Lib/site-packages/pychecker/checker.py --only setup.py
Processing module setup (setup.py)...
Warnings...
None
更多的参数,可以使用pychecker --help查看
 PyChecker:Python代码静态检查工具
PyChecker:Python代码静态检查工具
         
                   
                   
                   
                   
                             PyChecker是一个用于查找Python源代码中错误的静态分析工具。它类似于lint,能够发现通常由编译器在静态语言中捕捉的问题。本文介绍了PyChecker的安装和使用方法,包括如何通过命令行运行pychecker检查代码。
PyChecker是一个用于查找Python源代码中错误的静态分析工具。它类似于lint,能够发现通常由编译器在静态语言中捕捉的问题。本文介绍了PyChecker的安装和使用方法,包括如何通过命令行运行pychecker检查代码。
           
       
           
                 
                 
                 
                 
                 
                
               
                 
                 
                 
                 
                
               
                 
                 扫一扫
扫一扫
                     
              
             
                   6807
					6807
					
 被折叠的  条评论
		 为什么被折叠?
被折叠的  条评论
		 为什么被折叠?
		 
		  到【灌水乐园】发言
到【灌水乐园】发言                                
		 
		 
    
   
    
   
             
            


 
            