Reuse Sonar Checkstyle Violation Report for Custom Data Analysis
Write a violation rules file;
Import it into Sonar as a Quality Profile named as "MyRules";
Add the following properties to ant script:
Run Ant script, and you can get the report at $PROJECT_HOME/.sonar/checkstyle-result.xml;
Use the following python script to extract data from the report:
from xml.etree import ElementTree as ET
tree = ET.parse('/path/to/checkstyle-result.xml')
root = tree.getroot()
cycleCnt = 0
nestCnt = 0
for error in root.iter('error'):
msg = error.get('message')
if msg.startswith('Cyclomatic'):
cycleCnt += 1
if msg.startswith('Nested'):
nestCnt += 1
print "Cyclomatic:",cycleCnt,"Nested:",nestCnt
See "Section 19.7: xml.etree.ElementTree" of documentation of Python 2.7.5 for details.
Reuse Sonar Checkstyle Violation Report for Custom Data Analysis的更多相关文章
- Custom Data Service Providers
Custom Data Service Providers Introduction Data Services sits above a Data Service Provider, which i ...
- [TypeScript] Custom data structures in TypeScript with iterators
We usually think of types as something that can define a single layer of an object: with an interfac ...
- An Introduction to Stock Market Data Analysis with R (Part 1)
Around September of 2016 I wrote two articles on using Python for accessing, visualizing, and evalua ...
- Generic recipe for data analysis with general linear model
Generic recipe for data analysis with general linear model Courtesy of David Schneider State populat ...
- 《利用Python进行数据分析: Python for Data Analysis 》学习随笔
NoteBook of <Data Analysis with Python> 3.IPython基础 Tab自动补齐 变量名 变量方法 路径 解释 ?解释, ??显示函数源码 ?搜索命名 ...
- Python for Data Analysis
Data Analysis with Python ch02 一些有趣的数据分析结果 Male描述的是美国新生儿男孩纸的名字的最后一个字母的分布 Female描述的是美国新生儿女孩纸的名字的最后一个字 ...
- Learning Spark: Lightning-Fast Big Data Analysis 中文翻译
Learning Spark: Lightning-Fast Big Data Analysis 中文翻译行为纯属个人对于Spark的兴趣,仅供学习. 如果我的翻译行为侵犯您的版权,请您告知,我将停止 ...
- 深入浅出数据分析 Head First Data Analysis Code 数据与代码
<深入浅出数据分析>英文名为Head First Data Analysis Code, 这本书中提供了学习使用的数据和程序,原书链接由于某些原因不 能打开,这里在提供一个下载的链接.去下 ...
- How to use data analysis for machine learning (example, part 1)
In my last article, I stated that for practitioners (as opposed to theorists), the real prerequisite ...
随机推荐
- hdu 1116 敌兵布阵 线段树 区间求和 单点更新
线段树的基本知识可以先google一下,不是很难理解 线段树功能:update:单点增减 query:区间求和 #include <bits/stdc++.h> #define lson ...
- python 正则表达式 初级
举例: 1.匹配hello world key = r"<h1>hello world<h1>" #源文本 p1 = r"<h1>.+ ...
- XCTF Guess-the-Number
一.发现是jar文件,一定想到反汇编gdui这个工具,而且运行不起来,可能是我电脑问题,我就直接反编译出来了. 也发现了flag,和对应的算法,直接拉出来,在本地运行,后得到flag 二.java代码
- 第六章 time库的使用
time库概述 time库是python中处理时间的标准库 1.用于计算机时间的表达 2.提供获取系统时间并格式化输出功能 3.提供系统级精确计时功能,用于程序性能分析 1 import time 2 ...
- CURL 实战下载
#include <string> #include <stdio.h> #include <iostream> #include<fstream> # ...
- dp 套 dp扯谈
1.[扯谈概念] \(dp\) 套 \(dp\) 其实也就是 \(dp\) . 这里就定义下面两个概念: 内层 \(dp\) 表示的是被套在里面的那个 \(dp\) 外层 \(dp\) 表示的是最外面 ...
- C语言:按行读TXT文件
//搂行读取TXT #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_L ...
- 怀疑前端组件把我的excel文件搞坏了,怎么证明
背景 我在做个需求,用户通过excel上传文件,文件中,每一行就是一条数据,后台批量处理:但是呢,用户填的数据可能有问题,所以我后台想先做个检查,然后在每一行中加一列,来指出这一行存在的问题. 我本来 ...
- vue(23)Vuex的5个核心概念
Vuex的核心概念 Vuex有5个核心概念,分别是State,Getters,mutations,Actions,Modules. State Vuex使用单一状态树,也就是说,用一个对象包含了所 ...
- 在NestJS 中添加对Stripe 的WebHook 验证
在NestJS 中添加对Stripe 的WebHook 验证 背景介绍 Nest 是一个用于构建高效,可扩展的NodeJS 服务器端应用程序的框架.它使用渐进式JavaScript, 内置并完全支持T ...