Configurations to enable Code Review to prevent users check in



When using Visual Studio 2012 and TFS 2012 I need to enable automatic Code Review with DevPartner 11.0 whenever code is checked-in. What configurations are needed to prevent users from check-in, in the case that the number of issues reported is more than a certain number (such as 10 high priority issues)?


Code Review does not have option to enable an automatic Code Review that would integrate with analyzing newly checked in code into third-party software. A batch file would need to be created to automatically start a second batch file when new code files are being checked in. Within that second batch file, the CRBatch.exe (see details below) would need to be called similar to the following:

"C:\Program Files (x86)\Micro Focus\DevPartner Studio\CodeReview\crbatch.exe" /f

"C:\Users\Main\Desktop\FILENAME.crb" /l "C:\Users\Main\Desktop\CR_FILENAME.xml" /vs "11.0"  

Here is the generic command line command where you would use your own data:

CRBatch.exe [/?] /f filename [/vs version] [/l XML filename]

NOTE: There might be a way to create a batch file (which you would want to link in the first batch file to call this third file once the second batch file is running) that will analyze how many lines populate in the error file such as using command line utilities, command line commands such as set, for and call.array. Within these commands and the below mentioned features you may be able to create parameters that search for the high level errors that you want to detect and halt the running of the CRBatch.exe when you. You would first want to convert the Code Review report and parse that file to XML or a CSV file with parameters such as: if errors < 10-continue else terminate However we have not tested this in our own lab environments.

Though Code Review is not designed specifically for automation that would require management of a user’s database or managing users, Code Review does have the functionality in the creation of custom batch scripting. You can obtain and refer to the product documentation on your system at C:\Program Files (x86)\Micro Focus\DevPartner Studio\Understanding DevPartner.PDF and DPS Quick Ref.pdf. Code review has the following features that could assist in providing you the means to creating a custom batch file that is specific to your system and I will add the page number to reference to within the documentation:

  • Code Review Section (pg. 59-107)
  • Configurations will be stored in the directory of the file or solution (pg. 68,69)
  • Creates a batch file on default (pg. 85)
  • Command line, Syntax Options and Batch file options (pg. 85-90)
  • Command line/Batch file switches for customization (pg. 85-86)
  • Code Review error codes (pg. 88)

To answer your second question consequently, Code Review can supply the means of generating the necessary reports indicating the adherence of coding standards e.g., Visual Basic, C#, and or Visual Studio Coding Standards [default]. Furthermore, Code Review being called with the command line interface has many useful error codes relative to the batch process if you attempt to customize script.  




Comment List
Related Discussions