Skip to content

Commit

Permalink
#700 Fixed handling of .netconfig files (sourceDirectories, reportTyp…
Browse files Browse the repository at this point in the history
…es, plugins, assemblyFilters, etc.)
  • Loading branch information
danielpalme committed Dec 6, 2024
1 parent b92ea55 commit 537c17c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,33 +128,33 @@ section. Examples:

```gitconfig
[ReportGenerator]
reports = coverage.xml
reports = "coverage.xml"
targetdir = "C:\\report"
reporttypes = Latex,HtmlSummary
assemblyfilters = +Test,-Test
classfilters = +Test2,-Test2
reporttypes = "Latex;HtmlSummary"
assemblyfilters = "+Test;-Test"
classfilters = "+Test2;-Test2"
```

All the plural options can also be specified as multiple singular entries, like:

```gitconfig
[ReportGenerator]
report = coverage1.xml
report = coverage2.xml
reporttype = Latex
reporttype = HtmlSummary
assemblyfilter = +Test
assemblyfilter = -Test
classfilter = +Test2
classfilter = -Test2
filefilter = +cs
filefilter = -vb
riskhotspotassemblyfilter = +Test
riskhotspotassemblyfilter = -Test
riskhotspotclassfilter = +Test2
riskhotspotclassfilter = -Test2
sourcedir = src
sourcedir = test
report = "coverage1.xml"
report = "coverage2.xml"
reporttype = "Latex"
reporttype = "HtmlSummary"
assemblyfilter = "+Test"
assemblyfilter = "-Test"
classfilter = "+Test2"
classfilter = "-Test2"
filefilter = "+cs"
filefilter = "-vb"
riskhotspotassemblyfilter = "+Test"
riskhotspotassemblyfilter = "-Test"
riskhotspotclassfilter = "+Test2"
riskhotspotclassfilter = "-Test2"
sourcedir = "src"
sourcedir = "test"
```

Adding/removing values is trivial using the [dotnet-config](https://dotnetconfig.org) CLI:
Expand Down Expand Up @@ -197,11 +197,11 @@ Given the following `.netconfig`:

```gitconfig
[ReportGenerator]
reporttypes = Html;Latex
targetdirectory = report
historydirectory = history
assemblyfilters = +Include;-Excluded
verbosityLevel = Verbose
reporttypes = "Html;Latex"
targetdirectory = "report"
historydirectory = "history"
assemblyfilters = "+Include;-Excluded"
verbosityLevel = "Verbose"
```

The above target could be simplified as:
Expand Down
4 changes: 4 additions & 0 deletions src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ For further details take a look at LICENSE.txt.

CHANGELOG

5.4.2.0

* Fix: #700 Fixed handling of .netconfig files (sourceDirectories, reportTypes, plugins, assemblyFilters, etc.)

5.4.1.0

* Fix: #707 Fixed issue with file filters
Expand Down
18 changes: 9 additions & 9 deletions src/ReportGenerator.Core/ReportConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.Reports, out value))
{
reportFilePatterns = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
reportFilePatterns = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -78,7 +78,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.SourceDirectories, out value))
{
sourceDirectories = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
sourceDirectories = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand Down Expand Up @@ -108,7 +108,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.ReportTypes, out value))
{
reportTypes = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
reportTypes = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -125,7 +125,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.Plugins, out value))
{
plugins = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
plugins = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -146,7 +146,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.AssemblyFilters, out value))
{
assemblyFilters = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
assemblyFilters = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -163,7 +163,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.ClassFilters, out value))
{
classFilters = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
classFilters = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -180,7 +180,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.FileFilters, out value))
{
fileFilters = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
fileFilters = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -197,7 +197,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.RiskHotspotAssemblyFilters, out value))
{
riskHotspotAssemblyFilters = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
riskHotspotAssemblyFilters = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand All @@ -214,7 +214,7 @@ public ReportConfiguration Create(Dictionary<string, string> cliArguments)
}
else if (config.TryGetString(DotNetConfigSettingNames.RiskHotspotClassFilters, out value))
{
riskHotspotClassFilters = value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
riskHotspotClassFilters = value.Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries);
}
else
{
Expand Down

0 comments on commit 537c17c

Please sign in to comment.