我正在尝试将JaCoCo报道报告转换为Cobertura格式(因为Shippable仅支持Cobertura)。 This家伙声称有一个工具将JaCoCo转换为Cobertura,但是在运行他的脚本时我收到以下错误:
Traceback (most recent call last):
File "cover2cover.py", line 151, in <module>
jacoco2cobertura(filename, source_root)
File "cover2cover.py", line 139, in jacoco2cobertura
convert_root(root, into, source_root)
File "cover2cover.py", line 127, in convert_root
packages.append(convert_package(package))
File "cover2cover.py", line 113, in convert_package
c_classes.append(convert_class(j_class, j_package))
File "cover2cover.py", line 100, in convert_class
c_methods.append(convert_method(j_method, j_method_lines))
File "cover2cover.py", line 85, in convert_method
convert_lines(j_lines, c_method)
File "cover2cover.py", line 33, in convert_lines
for jline in j_lines:
File "cover2cover.py", line 23, in method_lines
larger = list(int(jm.attrib['line']) for jm in jmethods if int(jm.attrib['line']) > start_line)
File "cover2cover.py", line 23, in <genexpr>
larger = list(int(jm.attrib['line']) for jm in jmethods if int(jm.attrib['line']) > start_line)
KeyError: 'line'
我对python一无所知,所以任何帮助都会受到赞赏。
答案 0 :(得分:0)
我也不知道python,但我知道python 2和python 3有很大的不同。也许你碰到了那个?
我能够使用此版本运行脚本:
$> python --version
Python 2.7.11
为确保我在没有任何下载或浏览器或行结束类型问题的情况下获得脚本,我确实克隆了git repo:
$> git clone https://github.com/rix0rrr/cover2cover.git
然后脚本先运行我的jacoco XML文件。