33using Stryker . Abstractions . Options ;
44using Stryker . Abstractions . ProjectComponents ;
55using Stryker . Abstractions . Reporting ;
6+ using Stryker . Core . ProjectComponents ;
67using Stryker . Core . Reporters . Json . SourceFiles ;
78using Stryker . Core . Reporters . Json . TestFiles ;
89
@@ -25,39 +26,47 @@ private JsonReport(IStrykerOptions options, IReadOnlyProjectComponent mutationRe
2526
2627 ProjectRoot = mutationReport . FullPath ;
2728
28- Merge ( Files , GenerateReportComponents ( mutationReport ) ) ;
29+ Merge ( Files , GenerateReportComponents ( options , mutationReport ) ) ;
2930 AddTestFiles ( testProjectsInfo ) ;
3031 }
3132
3233 public static IJsonReport Build ( IStrykerOptions options , IReadOnlyProjectComponent mutationReport , ITestProjectsInfo testProjectsInfo ) => new JsonReport ( options , mutationReport , testProjectsInfo ) ;
3334
34- private IDictionary < string , ISourceFile > GenerateReportComponents ( IReadOnlyProjectComponent component )
35+ private Dictionary < string , ISourceFile > GenerateReportComponents ( IStrykerOptions options , IReadOnlyProjectComponent component )
3536 {
3637 var files = new Dictionary < string , ISourceFile > ( ) ;
38+
3739 if ( component is IFolderComposite folder )
3840 {
39- Merge ( files , GenerateFolderReportComponents ( folder ) ) ;
41+ Merge ( files , GenerateFolderReportComponents ( options , folder ) ) ;
4042 }
4143 else if ( component is IReadOnlyFileLeaf file )
4244 {
43- Merge ( files , GenerateFileReportComponents ( file ) ) ;
45+ Merge ( files , GenerateFileReportComponents ( options , file ) ) ;
4446 }
4547
4648 return files ;
4749 }
4850
49- private IDictionary < string , ISourceFile > GenerateFolderReportComponents ( IFolderComposite folderComponent )
51+ private Dictionary < string , ISourceFile > GenerateFolderReportComponents ( IStrykerOptions options , IFolderComposite folderComponent )
5052 {
5153 var files = new Dictionary < string , ISourceFile > ( ) ;
5254 foreach ( var child in folderComponent . Children )
5355 {
54- Merge ( files , GenerateReportComponents ( child ) ) ;
56+ Merge ( files , GenerateReportComponents ( options , child ) ) ;
5557 }
5658
5759 return files ;
5860 }
5961
60- private static IDictionary < string , ISourceFile > GenerateFileReportComponents ( IReadOnlyFileLeaf fileComponent ) => new Dictionary < string , ISourceFile > { { fileComponent . FullPath , new SourceFile ( fileComponent ) } } ;
62+ private static Dictionary < string , ISourceFile > GenerateFileReportComponents ( IStrykerOptions options , IReadOnlyFileLeaf fileComponent )
63+ {
64+ if ( fileComponent . IsComponentExcluded ( options . Mutate ) )
65+ {
66+ return new Dictionary < string , ISourceFile > { { fileComponent . FullPath , SourceFile . Ignored } } ;
67+ }
68+ return new Dictionary < string , ISourceFile > { { fileComponent . FullPath , new SourceFile ( fileComponent ) } } ;
69+ }
6170
6271 private void AddTestFiles ( ITestProjectsInfo testProjectsInfo )
6372 {
0 commit comments