Online and CHM
GetQualityViolationsForFile(String,List<QualityViolation>) Method
Example 



KellermanSoftware.StaticCodeAnalysis Namespace > QualityLogic Class : GetQualityViolationsForFile(String,List<QualityViolation>) Method
Check a single file for code quality issues
Syntax
'Declaration
 
Public Function GetQualityViolationsForFile( _
   ByVal filePath As String, _
   Optional ByVal baselineViolations As List(Of QualityViolation) _
) As QualityResult
'Usage
 
Dim instance As QualityLogic
Dim filePath As String
Dim baselineViolations As List(Of QualityViolation)
Dim value As QualityResult
 
value = instance.GetQualityViolationsForFile(filePath, baselineViolations)
public QualityResult GetQualityViolationsForFile( 
   string filePath,
   List<QualityViolation> baselineViolations
)

Parameters

filePath
baselineViolations
Exceptions
ExceptionDescription
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
The exception that is thrown when an attempt to access a file that does not exist on disk fails.
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
string filePath = @"c:\_git\Compare-Net-Objects\Compare-Net-Objects\TypeComparers\PropertyComparer.cs";
QualityResult qualityResult =  quality.GetQualityViolationsForFile(filePath);
 
string reportPath = Path.Combine(Environment.CurrentDirectory, "QualityResult.html");
quality.ExportViolationsToHtmlReportFile(qualityResult, TemplateName.BlackAndBlue, reportPath);
'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 filePath As String = "c:\_git\Compare-Net-Objects\Compare-Net-Objects\TypeComparers\PropertyComparer.cs"
Dim qualityResult As QualityResult = quality.GetQualityViolationsForFile(filePath)
 
Dim reportPath As String = Path.Combine(Environment.CurrentDirectory, "QualityResult.html")
quality.ExportViolationsToHtmlReportFile(qualityResult, TemplateName.BlackAndBlue, reportPath)
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