如何使用声纳重新分析项目的完整历史记录?

发布于 2024-10-27 21:48:06 字数 380 浏览 2 评论 0原文

我想将自项目启动以来的整个项目历史记录加载到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萌梦深 2024-11-03 21:48:06

这是来自邮件列表:

事实上,要导入历史数据,您必须使用“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.

你的背包 2024-11-03 21:48:06

我只是在寻找完全相同的东西,并在 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.

软的没边 2024-11-03 21:48:06

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

桃酥萝莉 2024-11-03 21:48:06

只是发现 @adam-banko 中的脚本不再适合我了(因为它已经有 8 岁了) 。

这是一个更新的Python3脚本,用于上传maven项目的历史快照:
https://gist.github.com/hughluo/c51b14cfcd9afe3f89149f478c1a65d5

用法

  1. 更改日期脚本中的范围以满足您的需求。

  2. 将脚本放入项目根目录pom.xml所在的文件夹中并运行

SONAR_HOST=<sonar.host.url> SONAR_LOGIN=<sonar.login> SONAR_PROJECT=<sonar.projectKey> python3 upload_snapshots_sonar.py

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

  1. Change the date range in the script to fit your needs.

  2. Put the script in the folder where your project root pom.xml located in and run

SONAR_HOST=<sonar.host.url> SONAR_LOGIN=<sonar.login> SONAR_PROJECT=<sonar.projectKey> python3 upload_snapshots_sonar.py
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文