SCMLife.com

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 6676|回复: 1

[求助] CPPCHECK htmlreport 报错!

[复制链接]
发表于 2011-8-9 17:38:10 | 显示全部楼层 |阅读模式
本帖最后由 ths0516 于 2011-8-9 17:53 编辑
/ O& G* s! q% b9 J* q' b5 |+ c. l1 t3 O7 i1 V6 a
CPPCHECK出来的XML。除了用hudson之外,还有其他的办法转换成HTML吗》?有人用过吗?  J% o  Z8 ]) p/ C
文档里有& ^3 i1 S) T. k; Z& @# a3 {
cppcheck-htmlreport& m" p" x3 k$ Z' f& w2 D
但我使用这个时候报错误信息9 F* ^% m7 P& L* I0 {& Y5 [
错误信息如下:
+ c. T6 e. A) O: }1 L4 YParsing xml report.
" @- b/ `. K2 g2 P8 q3 l/ TTraceback (most recent call last):. r5 ~" Q  J' X6 g/ V2 y: }
  File "c:\Python27\Scripts\cppcheck-htmlreport", line 225, in <module>
* r1 o! |+ B+ `* W" o" ?/ n( r! e    xml_parse(stream, contentHandler)
- p+ v0 D- z+ b( N' j0 ]  File "C:\Python27\lib\xml\sax\__init__.py", line 33, in parse' y/ `5 F+ Y4 M# R7 C, t
    parser.parse(source)! `* g6 o* R2 k1 |& }8 J3 T
  File "C:\Python27\lib\xml\sax\expatreader.py", line 107, in parse
. U& `7 }9 a8 v( q" L    xmlreader.IncrementalParser.parse(self, source)
3 I, Z3 W3 J' d4 Y  File "C:\Python27\lib\xml\sax\xmlreader.py", line 123, in parse
: B6 B) u! ~9 @    self.feed(buffer)
+ O( h, h5 c- U5 h* ]) m  ^  File "C:\Python27\lib\xml\sax\expatreader.py", line 207, in feed  b- k! c5 Q  J6 g( A
    self._parser.Parse(data, isFinal)0 O" w$ X1 f: g3 V6 J9 x
  File "C:\Python27\lib\xml\sax\expatreader.py", line 301, in start_element
) E9 v' G; h: Y0 H8 Z    self._cont_handler.startElement(name, AttributesImpl(attrs))7 Y2 K$ @5 ~4 g, i3 u- L! q) C
  File "c:\Python27\Scripts\cppcheck-htmlreport", line 184, in startElement0 {8 U$ l2 u8 E0 N3 n' p  `1 ^
    if attributes["file"] == "":
9 u4 {8 _3 d( U' k  File "C:\Python27\lib\xml\sax\xmlreader.py", line 316, in __getitem__/ q& C  x: X' D, ^( v  I
    return self._attrs[name]
) y# e3 T3 V: W4 r' q  j* SKeyError: 'file'3 u& I4 I; `# g, J  T
2 ~0 e' _2 ^/ P# u% m
参考文件: ]' b; H6 a/ `- s
http://cppcheck.sourceforge.net/manual.pdf
) [/ ?" n$ ~+ O( W( h1 [+ y4 D8 [1 ]. w% j# \2 G9 a0 }; Z
The output screen says:
+ K- d; s/ s* R& gUsage: cppcheck-htmlreport [options]
& g! N3 d6 u. T/ b7 ]Options:
2 v9 l# @, `- H2 y# I/ P# A1 l-h, --help show this help message and exit
2 ^' U9 }  j/ r3 s* Z; A! _--file=FILE The cppcheck xml output file to read defects from.) S8 W) r( t0 P) E+ K) @" V
Default is reading from stdin.
, ]+ q+ _; k' ?; b& q' l8 j% @--report-dir=REPORT_DIR
/ i4 }! B( |+ f" O: ?The directory where the html report content is written.
, a! ^4 z" y, L0 Z9 l2 r: L* |--source-dir=SOURCE_DIR4 x9 c9 r5 e+ W; A( ?9 x6 _& J
Base directory where source code files can be found.
! [6 `) `1 M8 |( C; qAn example usage:. c: f) p, B+ N* c
./cppcheck gui/test.cpp --xml 2> err.xml( z" Y8 _* l- J, _. m
htmlreport/cppcheck-htmlreport --file=err.xml --report-dir=test1 --source-dir=.4 r% Q  s8 {! Z2 A4 a$ j
13
: X+ o! `' l* i# [
# p1 q; f" a9 B" }0 m; f
 楼主| 发表于 2011-8-12 10:42:41 | 显示全部楼层
本帖最后由 ths0516 于 2011-8-12 12:16 编辑 3 z1 x+ t# ]9 p
6 q9 u5 A% d& G3 ^' I
测试了 python 2.6  2.7 cppcheck 1.47 1.49 都是一样的错误,郁闷!+ f% X2 v0 P8 Y4 t. O& g
个人感觉在SAX部分,解析XML出了问题!
; N+ ?5 u; V1 d! W3 P0 A1 J
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|无图版|SCMLife.com ( 京ICP备06056490号-1 )

GMT+8, 2018-4-23 20:23 , Processed in 0.059822 second(s), 6 queries , Gzip On, MemCache On.

Powered by SCMLife X3.4 Licensed

© 2001-2017 JoyShare.

快速回复 返回顶部 返回列表