自定义代码分析TFS签到策略

时间:2021-07-14 22:36:11

Is there any way to create a custom TFS check-in policy that can jump through each node within the code being checked in for code standards we have defined?

有没有办法创建一个自定义TFS签到策略,可以跳过我们已定义的代码标准的签入代码中的每个节点?

2 个解决方案

#1


Take a look at this particular screencast. It's a very good place to start.

看一下这个特别的截屏视频。这是一个非常好的起点。

You might also want to take a look at the StyleCop CodePlex project which deal with stuffs like coding standard and formatting.

您可能还想查看StyleCop CodePlex项目,该项目处理编码标准和格式等内容。

The combination of the two might yield you what you want.

两者的结合可能会产生你想要的东西。

Here is another resource if you like reading instead of watching.

如果您喜欢阅读而不是观看,这是另一种资源。

#2


You don't need a separate check-in policy for that. Use the policy that requires that the code be built. Configure the solution to require code analysis, and set the rules so that the most important rules cause errors when they're violated.

您不需要单独的签到政策。使用要求构建代码的策略。将解决方案配置为需要进行代码分析,并设置规则,以便最重要的规则在违反时导致错误。

When the rules are violated, the code won't build, and since the code won't build, you can't check it in.

违反规则时,代码将无法构建,并且由于代码无法构建,因此无法检入。

#1


Take a look at this particular screencast. It's a very good place to start.

看一下这个特别的截屏视频。这是一个非常好的起点。

You might also want to take a look at the StyleCop CodePlex project which deal with stuffs like coding standard and formatting.

您可能还想查看StyleCop CodePlex项目,该项目处理编码标准和格式等内容。

The combination of the two might yield you what you want.

两者的结合可能会产生你想要的东西。

Here is another resource if you like reading instead of watching.

如果您喜欢阅读而不是观看,这是另一种资源。

#2


You don't need a separate check-in policy for that. Use the policy that requires that the code be built. Configure the solution to require code analysis, and set the rules so that the most important rules cause errors when they're violated.

您不需要单独的签到政策。使用要求构建代码的策略。将解决方案配置为需要进行代码分析,并设置规则,以便最重要的规则在违反时导致错误。

When the rules are violated, the code won't build, and since the code won't build, you can't check it in.

违反规则时,代码将无法构建,并且由于代码无法构建,因此无法检入。