如何使用声纳重新分析项目的完整历史记录?
我想将自项目启动以来的整个项目历史记录加载到 Sonar 中。
我基本上想执行这样的代码:
0) checkout version 1 from Subversion 1) checkout next version from Subversion 2) if the commit date is from the same day as the previous one - goto 1 3) run mvn sonar:sonar, overriding the build time with the time of the commit 4) if not on last commit - goto 1
是否有工具可以执行此操作?有没有办法说服声纳使用与当前日期不同的日期?
I would like to load the entire project history since its inception into Sonar.
I would basically want to execute code like this:
0) checkout version 1 from Subversion 1) checkout next version from Subversion 2) if the commit date is from the same day as the previous one - goto 1 3) run mvn sonar:sonar, overriding the build time with the time of the commit 4) if not on last commit - goto 1
Is there a tool that does this already? Is there a way of convincing Sonar to use a different date than the current one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是来自邮件列表:
事实上,要导入历史数据,您必须使用“sonar.projectDate”属性(格式为 yyyy-MM-dd,例如 2010-12-25)[1] 并对每个日期启动声纳分析您希望在项目历史记录中看到的标签/分支。
http://sonarqube.15.x6.nabble.com/re-ordering- Historical-data-td3191565.html
还有一个额外的博文进一步解释了这一点。
This is from the Mailing Lists:
Indeed, to import historical data you must use the "sonar.projectDate" property (Format is yyyy-MM-dd, for example 2010-12-25) [1] and launch a Sonar analysis on each tag/branch that you'd like to see in your project history.
http://sonarqube.15.x6.nabble.com/re-ordering-historical-data-td3191565.html
There is an additional Blogpost that explains this further.
我只是在寻找完全相同的东西,并在 GitHub 中找到了一个方便的 bash 脚本:
https://gist.github .com/aslakknutsen/2422117
该脚本检查每个标签(从作为参数给出的特定标签开始),将标签日期设置为 sonar.projectDate 并对其运行声纳分析。非常方便。我想我可能需要稍微修改一下,因为我们在仓库中没有那么多标签,也许每周进行一次分析或其他什么。
I was just searching for this exact same thing and found a handy bash script in GitHub:
https://gist.github.com/aslakknutsen/2422117
The script does a checkout of each tag (beginning from a specific tag given as a parameter), sets the tag date as sonar.projectDate and runs sonar analysis on it. Very handy. I think I might have to modify it a little bit since we don't have that much tags in the repo, maybe do a weekly analysis or something.
Python 工具,用于加载自给定日期以来每月/每周的快照。
https://gist.github.com/Cassus/6229929
Python tool to load a snapshot for every month/week since a given date.
https://gist.github.com/Cassus/6229929
只是发现 @adam-banko 中的脚本不再适合我了(因为它已经有 8 岁了) 。
这是一个更新的Python3脚本,用于上传maven项目的历史快照:
https://gist.github.com/hughluo/c51b14cfcd9afe3f89149f478c1a65d5
用法
更改日期脚本中的范围以满足您的需求。
将脚本放入项目根目录
pom.xml
所在的文件夹中并运行Just find out the script from @adam-banko does not work for me anymore (since it is 8 years old).
Here is an updated Python3 script to upload historical snapshots of maven project:
https://gist.github.com/hughluo/c51b14cfcd9afe3f89149f478c1a65d5
Usage
Change the date range in the script to fit your needs.
Put the script in the folder where your project root
pom.xml
located in and run