Online and CHM
SaveBaselineViolations Method
Example 



KellermanSoftware.StaticCodeAnalysis Namespace > QualityLogic Class : SaveBaselineViolations Method
Save violations to be used later to ignore in a Quality Check
Syntax
'Declaration
 
Public Sub SaveBaselineViolations( _
   ByVal violations As List(Of QualityViolation), _
   ByVal filePath As String _
) 
'Usage
 
Dim instance As QualityLogic
Dim violations As List(Of QualityViolation)
Dim filePath As String
 
instance.SaveBaselineViolations(violations, filePath)
public void SaveBaselineViolations( 
   List<QualityViolation> violations,
   string filePath
)
public:
void SaveBaselineViolations( 
   List<QualityViolation^>^ violations,
   String^ filePath
) 

Parameters

violations
filePath
Example
//Trial Mode
QualityLogic quality = new QualityLogic();
 
//Licensed Mode
//QualityLogic quality = new QualityLogic("User Name from Receipt", "License Key from Receipt");
 
//Test using this open source project:  https://github.com/GregFinzer/Compare-Net-Objects
QualityResult qualityResult =
    quality.GetQualityViolationsForDirectory(@"c:\_git\Compare-Net-Objects\Compare-Net-Objects");
 
//Save base line violations
string baselineFilePath = Path.Combine(Environment.CurrentDirectory, "BaselineViolations.json");
quality.SaveBaselineViolations(qualityResult.QualityViolations, baselineFilePath);
 
//Load the violations
List<QualityViolation> baseLineViolations = quality.LoadBaselineViolations(baselineFilePath);
 
//Get violations using baseline
QualityResult qualityResultUsingBaseline =
    quality.GetQualityViolationsForDirectory(@"c:\_git\Compare-Net-Objects\Compare-Net-Objects",
        baseLineViolations);
 
//Export the results to an HTML Report (there will be none since the baseline)
string htmlReportFilePath = Path.Combine(Environment.CurrentDirectory, "QualityResultWithBaseline.html");
quality.ExportViolationsToHtmlReportFile(qualityResultUsingBaseline, TemplateName.BlackAndBlue, htmlReportFilePath);
'Trial Mode
Dim quality As New QualityLogic()
 
'Licensed Mode
'QualityLogic quality = new QualityLogic("User Name from Receipt", "License Key from Receipt");
 
'Test using this open source project:  https://github.com/GregFinzer/Compare-Net-Objects
Dim qualityResult As QualityResult = quality.GetQualityViolationsForDirectory("c:\_git\Compare-Net-Objects\Compare-Net-Objects")
 
'Save base line violations
Dim baselineFilePath As String = Path.Combine(Environment.CurrentDirectory, "BaselineViolations.json")
quality.SaveBaselineViolations(qualityResult.QualityViolations, baselineFilePath)
 
'Load the violations
Dim baseLineViolations As List(Of QualityViolation) = quality.LoadBaselineViolations(baselineFilePath)
 
'Get violations using baseline
Dim qualityResultUsingBaseline As QualityResult = quality.GetQualityViolationsForDirectory("c:\_git\Compare-Net-Objects\Compare-Net-Objects", baseLineViolations)
 
'Export the results to an HTML Report (there will be none since the baseline)
Dim htmlReportFilePath As String = Path.Combine(Environment.CurrentDirectory, "QualityResultWithBaseline.html")
quality.ExportViolationsToHtmlReportFile(qualityResultUsingBaseline, TemplateName.BlackAndBlue, htmlReportFilePath)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

QualityLogic Class
QualityLogic Members