为声纳验证创建svn pre commit hook脚本

人气:781 发布:2022-09-22 标签: perl python svn

问题描述

预提交钩子脚本场景: 当用户尝试将代码签入svn存储库时,必须进行声纳分析。如果存在任何违规,则不得允许提交。 我是新来的。所以请指导我。

解决方案

请不要这样的钩子。如果您的代码库大小相当大,可能需要花费大量时间根据分析所需的时间来检查。 您应该看看在连续构建集成服务器上。这些在后台进行构建和分析。

我创建了一个.exe文件,它调用.bat文件并运行分析。根据分析过程中生成的日志文件中的某些错误消息,我将设置.exe文件的退出代码。如果退出0,则提交成功,否则失败。 此链接帮助很多: C#中的TortoiseSVN预提交钩子 - 给自己省点麻烦! [ ^ ]

A pre-commit hook script scenario: Whenver a user tries to check-in the code into the svn repository, a sonar analysis must be done. If there are any violations, the commit must not not be allowed. I am new to this. So please guide me.

解决方案

Please refrain from such hooks. If your code base is considerable in size, it may take a lot of time to check in based on the amount of time required to analyse. You should take a look at continuous build integration servers. These do a build and analysis in background.

I have create a .exe file, which calls the .bat file and runs the analysis. Based on certain error messages in the log file generated during the analysis, I will set the exit code of the .exe file. If exit 0, commit succeeds, else fails. This link helped a lot: TortoiseSVN pre-commit hook in C# - Save yourself some troubles![^]

424