@@ -12,21 +12,21 @@ namespace VSPackage.CPPCheckPlugin
1212 class AnalyzerCppcheck : ICodeAnalyzer
1313 {
1414 private const string tempFilePrefix = "CPPCheckPlugin" ;
15-
15+
1616 public AnalyzerCppcheck ( )
1717 {
1818 // Perform some cleanup of old temporary files
1919 string tempPath = Path . GetTempPath ( ) ;
20-
21- try
20+
21+ try
2222 {
2323 // Get all files that have our unique prefix
2424 string [ ] oldFiles = Directory . GetFiles ( tempPath , tempFilePrefix + "*" ) ;
25-
26- foreach ( string file in oldFiles )
25+
26+ foreach ( string file in oldFiles )
2727 {
2828 DateTime fileModifiedDate = File . GetLastWriteTime ( file ) ;
29-
29+
3030 if ( fileModifiedDate . AddMinutes ( 120 ) < DateTime . Now )
3131 {
3232 // File hasn't been written to in the last 120 minutes, so it must be
@@ -35,9 +35,9 @@ public AnalyzerCppcheck()
3535 }
3636 }
3737 }
38- catch ( System . Exception ) { }
38+ catch ( System . Exception ) { }
3939 }
40-
40+
4141 ~ AnalyzerCppcheck ( )
4242 {
4343 cleanupTempFiles ( ) ;
@@ -78,7 +78,7 @@ public static string cppcheckExePath()
7878
7979 return analyzerPath ;
8080 }
81-
81+
8282 private string getCPPCheckArgs ( ConfiguredFiles configuredFiles , bool analysisOnSavedFile , bool multipleProjects , string tempFileName )
8383 {
8484 Debug . Assert ( _numCores > 0 ) ;
@@ -127,27 +127,27 @@ private string getCPPCheckArgs(ConfiguredFiles configuredFiles, bool analysisOnS
127127 cppheckargs += ( " --suppress=" + suppression ) ;
128128 }
129129
130- if ( ! ( analysisOnSavedFile && Properties . Settings . Default . IgnoreIncludePaths ) )
131- {
132- // We only add include paths once, and then specify a set of files to check
133- HashSet < string > includePaths = new HashSet < string > ( ) ;
134- foreach ( var file in filesToAnalyze )
135- {
136- if ( ! matchMasksList ( file . FilePath , unitedSuppressionsInfo . SkippedFilesMask ) )
137- includePaths . UnionWith ( file . IncludePaths ) ;
138- }
139-
140- includePaths . Add ( filesToAnalyze [ 0 ] . BaseProjectPath ) ; // Fix for #60
141-
142- foreach ( string path in includePaths )
143- {
144- if ( ! matchMasksList ( path , unitedSuppressionsInfo . SkippedIncludesMask ) )
145- {
146- String includeArgument = " -I\" " + path + "\" " ;
147- cppheckargs = cppheckargs + " " + includeArgument ;
148- }
149- }
150- }
130+ if ( ! ( analysisOnSavedFile && Properties . Settings . Default . IgnoreIncludePaths ) )
131+ {
132+ // We only add include paths once, and then specify a set of files to check
133+ HashSet < string > includePaths = new HashSet < string > ( ) ;
134+ foreach ( var file in filesToAnalyze )
135+ {
136+ if ( ! matchMasksList ( file . FilePath , unitedSuppressionsInfo . SkippedFilesMask ) )
137+ includePaths . UnionWith ( file . IncludePaths ) ;
138+ }
139+
140+ includePaths . Add ( filesToAnalyze [ 0 ] . BaseProjectPath ) ; // Fix for #60
141+
142+ foreach ( string path in includePaths )
143+ {
144+ if ( ! matchMasksList ( path , unitedSuppressionsInfo . SkippedIncludesMask ) )
145+ {
146+ String includeArgument = " -I\" " + path + "\" " ;
147+ cppheckargs = cppheckargs + " " + includeArgument ;
148+ }
149+ }
150+ }
151151
152152 using ( StreamWriter tempFile = new StreamWriter ( tempFileName ) )
153153 {
@@ -167,7 +167,7 @@ private string getCPPCheckArgs(ConfiguredFiles configuredFiles, bool analysisOnS
167167 // Creating the list of all different macros (no duplicates)
168168 HashSet < string > macros = new HashSet < string > ( ) ;
169169 macros . Add ( "__cplusplus=199711L" ) ; // At least in VS2012, this is still 199711L
170- // Assuming all files passed here are from the same project / same toolset, which should be true, so peeking the first file for global settings
170+ // Assuming all files passed here are from the same project / same toolset, which should be true, so peeking the first file for global settings
171171 switch ( filesToAnalyze [ 0 ] . vcCompilerVersion )
172172 {
173173 case SourceFile . VCCompilerVersion . vc2003 :
@@ -239,7 +239,7 @@ private string getCPPCheckArgs(ConfiguredFiles configuredFiles, bool analysisOnS
239239 }
240240 else if ( ! cppheckargs . Contains ( "--force" ) )
241241 cppheckargs += " --force" ;
242-
242+
243243 return cppheckargs ;
244244 }
245245
@@ -355,7 +355,7 @@ protected override List<Problem> parseOutput(String output)
355355 return list ;
356356 }
357357 }
358- catch ( System . Exception ) { }
358+ catch ( System . Exception ) { }
359359
360360 if ( output . StartsWith ( "Checking " ) )
361361 {
@@ -427,7 +427,7 @@ private string createNewTempFileName()
427427 _tempFileNamesInUse . Add ( name ) ;
428428 return name ;
429429 }
430-
430+
431431 private Problem _unfinishedProblem = null ;
432432 private List < string > _tempFileNamesInUse = new List < string > ( ) ;
433433 }
0 commit comments