Skip to content

Commit

Permalink
Merge pull request #398 from tonyhallett/fix-colour-settings-not-refl…
Browse files Browse the repository at this point in the history
…ectedi-in-the-left-hand-margin

Much improved Editor colouring
  • Loading branch information
tonyhallett committed Mar 7, 2024
2 parents ff11055 + 7e088f4 commit e4ffb5d
Show file tree
Hide file tree
Showing 352 changed files with 13,774 additions and 1,749 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,3 +22,4 @@ x64/
*.ncrunchproject
_NCrunch_WebCompiler
/MSBuild_Logs
/MigrationBackup/f1627d49/FineCodeCoverageTests
Binary file modified Art/Options-Global.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/Output-Coverage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/Output-RiskHotspots.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/Output-Summary.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/preview-coverage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion FineCodeCoverage.sln
Expand Up @@ -7,7 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FineCodeCoverage", "FineCod
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{208EE360-4076-4680-A9B7-2BA9C17EA9FB}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
.github\workflows\addVsixLinkToIssues.yaml = .github\workflows\addVsixLinkToIssues.yaml
Expand Down
25 changes: 24 additions & 1 deletion FineCodeCoverage/FineCodeCoverage.csproj
Expand Up @@ -150,15 +150,38 @@
<PackageReference Include="Microsoft.Build.Locator">
<Version>1.4.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild">
<Version>3.8.0</Version>
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Composition.Analyzers">
<Version>16.9.20</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.206" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.TestWindow.Interfaces">
<Version>11.0.61030</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<Version>17.9.28</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.8.3038">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
1 change: 0 additions & 1 deletion FineCodeCoverage/source.extension.vsixmanifest
Expand Up @@ -7,7 +7,6 @@
<MoreInfo>https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage</MoreInfo>
<License>Resources\LICENSE</License>
<Icon>Resources\logo.png</Icon>
<PreviewImage>Resources\preview-coverage.png</PreviewImage>
<Tags>visual studio; code coverage; c#; vb; .net core; coverlet; unit test; free; community edition</Tags>
</Metadata>
<Installation>
Expand Down
30 changes: 28 additions & 2 deletions FineCodeCoverage2022/FineCodeCoverage2022.csproj
Expand Up @@ -32,7 +32,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;VS2022</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Expand Down Expand Up @@ -145,15 +145,38 @@
<PackageReference Include="Microsoft.Build.Locator">
<Version>1.4.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild">
<Version>4.0.1</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Composition.Analyzers">
<Version>17.7.40</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.1.32210.191" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.TestWindow.Interfaces">
<Version>11.0.61030</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<Version>17.9.28</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4054">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -167,6 +190,9 @@
<PackageReference Include="RSA.Fizzler.Systems.HtmlAgilityPack">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="StreamJsonRpc">
<Version>2.16.36</Version>
</PackageReference>
<PackageReference Include="Svg">
<Version>3.3.0</Version>
</PackageReference>
Expand Down
3 changes: 3 additions & 0 deletions FineCodeCoverage2022/Properties/AssemblyInfo.cs
Expand Up @@ -31,3 +31,6 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

[assembly: InternalsVisibleTo("FineCodeCoverageTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
1 change: 0 additions & 1 deletion FineCodeCoverage2022/source.extension.vsixmanifest
Expand Up @@ -7,7 +7,6 @@
<MoreInfo>https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage</MoreInfo>
<License>Resources\LICENSE</License>
<Icon>Resources\logo.png</Icon>
<PreviewImage>Resources\preview-coverage.png</PreviewImage>
<Tags>visual studio; code coverage; c#; vb; .net core; coverlet; unit test; free; community edition</Tags>
</Metadata>
<Installation>
Expand Down
43 changes: 36 additions & 7 deletions FineCodeCoverageTests/AppOptionsProvider_Tests.cs
Expand Up @@ -4,6 +4,7 @@
using AutoMoq;
using FineCodeCoverage.Core.Utilities;
using FineCodeCoverage.Options;
using Microsoft.VisualStudio.Settings;
using Moq;
using NUnit.Framework;

Expand All @@ -13,16 +14,16 @@ public class AppOptionsProvider_Tests
{
private AutoMoqer autoMocker;
private AppOptionsProvider appOptionsProvider;
private Mock<IWritableSettingsStore> mockWritableSettingsStore;
private Mock<WritableSettingsStore> mockWritableSettingsStore;

[SetUp]
public void Setup()
{
autoMocker = new AutoMoqer();
appOptionsProvider = autoMocker.Create<AppOptionsProvider>();
mockWritableSettingsStore = new Mock<IWritableSettingsStore>();
var mockWritableSettingsStoreProvider = autoMocker.GetMock<IWritableSettingsStoreProvider>();
mockWritableSettingsStoreProvider.Setup(
mockWritableSettingsStore = new Mock<WritableSettingsStore>();
var mockWritableUserSettingsStoreProvider = autoMocker.GetMock<IWritableUserSettingsStoreProvider>();
mockWritableUserSettingsStoreProvider.Setup(
writableSettingsStoreProvider => writableSettingsStoreProvider.Provide()
).Returns(mockWritableSettingsStore.Object);
}
Expand Down Expand Up @@ -205,7 +206,16 @@ public void Should_Not_Default_Any_Other_AppOptions_Properties()
nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin),
nameof(IAppOptions.ShowToolWindowToolbar),
nameof(IAppOptions.Hide0Coverable),
nameof(IAppOptions.DisabledNoCoverage)
nameof(IAppOptions.DisabledNoCoverage),
nameof(IAppOptions.ShowEditorCoverage),
nameof(IAppOptions.ShowCoverageInGlyphMargin),
nameof(IAppOptions.ShowCoveredInGlyphMargin),
nameof(IAppOptions.ShowUncoveredInGlyphMargin),
nameof(IAppOptions.ShowPartiallyCoveredInGlyphMargin),
nameof(IAppOptions.ShowLineCoveredHighlighting),
nameof(IAppOptions.ShowLinePartiallyCoveredHighlighting),
nameof(IAppOptions.ShowLineUncoveredHighlighting),
nameof(IAppOptions.UseEnterpriseFontsAndColors)
};
CollectionAssert.AreEquivalent(expectedSetters.Select(s => $"set_{s}"), invocationNames);
}
Expand Down Expand Up @@ -273,7 +283,6 @@ internal void Should_Use_Deseralized_String_From_Store_For_AppOption_Property(Fu
{ nameof(IAppOptions.AttributesInclude), new string[]{ "ainclude"}},
{ nameof(IAppOptions.CompanyNamesExclude), new string[]{ "cexclude"}},
{ nameof(IAppOptions.CompanyNamesInclude), new string[]{ "cinclude"}},
{ nameof(IAppOptions.CoverageColoursFromFontsAndColours), true},
{ nameof(IAppOptions.CoverletCollectorDirectoryPath), "p"},
{ nameof(IAppOptions.CoverletConsoleCustomPath), "cp"},
{ nameof(IAppOptions.CoverletConsoleGlobal), true},
Expand Down Expand Up @@ -313,14 +322,34 @@ internal void Should_Use_Deseralized_String_From_Store_For_AppOption_Property(Fu
{ nameof(IAppOptions.ShowCoverageInOverviewMargin),true},
{ nameof(IAppOptions.ShowCoveredInOverviewMargin),true},
{ nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin),true},
{ nameof(IAppOptions.ShowDirtyInOverviewMargin), true },
{ nameof(IAppOptions.ShowNewInOverviewMargin), true },
{ nameof(IAppOptions.ShowUncoveredInOverviewMargin),true},
{ nameof(IAppOptions.ShowNotIncludedInOverviewMargin),true},
{ nameof(IAppOptions.ShowToolWindowToolbar),true},
{nameof(IAppOptions.ExcludeAssemblies),new string[]{ "Exclude"} },
{nameof(IAppOptions.IncludeAssemblies),new string[]{ "Include"} },
{nameof(IAppOptions.NamespaceQualification),NamespaceQualification.AlwaysUnqualified },
{nameof(IAppOptions.OpenCoverRegister),OpenCoverRegister.Default },
{nameof(IAppOptions.OpenCoverTarget),"" },
{nameof(IAppOptions.OpenCoverTargetArgs),"" }
{nameof(IAppOptions.OpenCoverTargetArgs),"" },
{nameof(IAppOptions.ShowEditorCoverage),true },
{nameof(IAppOptions.ShowCoverageInGlyphMargin),true },
{nameof(IAppOptions.ShowCoveredInGlyphMargin),true },
{nameof(IAppOptions.ShowPartiallyCoveredInGlyphMargin),true },
{nameof(IAppOptions.ShowUncoveredInGlyphMargin),true },
{nameof(IAppOptions.ShowDirtyInGlyphMargin),true },
{nameof(IAppOptions.ShowNewInGlyphMargin),true },
{nameof(IAppOptions.ShowNotIncludedInGlyphMargin),true },
{nameof(IAppOptions.ShowLineCoverageHighlighting),true },
{nameof(IAppOptions.ShowLineCoveredHighlighting),true },
{nameof(IAppOptions.ShowLinePartiallyCoveredHighlighting),true },
{nameof(IAppOptions.ShowLineUncoveredHighlighting),true },
{nameof(IAppOptions.ShowLineDirtyHighlighting),true },
{nameof(IAppOptions.ShowLineNewHighlighting),true },
{nameof(IAppOptions.ShowLineNotIncludedHighlighting),true },
{nameof(IAppOptions.UseEnterpriseFontsAndColors),true },
{nameof(IAppOptions.EditorCoverageColouringMode), EditorCoverageColouringMode.UseRoslynWhenTextChanges }
};
var mockJsonConvertService = autoMocker.GetMock<IJsonConvertService>();
mockJsonConvertService.Setup(
Expand Down
63 changes: 63 additions & 0 deletions FineCodeCoverageTests/CoberturaDeserializer_Tests.cs
@@ -0,0 +1,63 @@
using NUnit.Framework;
using System.IO;
using FineCodeCoverage.Engine.Cobertura;
using System;
using System.Linq;

namespace FineCodeCoverageTests
{
public class CoberturaDeserializer_Tests
{
[Test]
public void Should_Deserialize_What_Is_Required()
{
var cobertura = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!DOCTYPE coverage SYSTEM ""http://cobertura.sourceforge.net/xml/coverage-04.dtd"">
<coverage line-rate=""0.127074535991358"" branch-rate=""0.101282051282051"" lines-covered=""1294"" lines-valid=""10183"" branches-covered=""395"" branches-valid=""3900"" complexity=""5304"" version=""1"" timestamp=""1709634604"">
<sources />
<packages>
<package name=""DemoOpenCover"" line-rate=""0.0271464646464646"" branch-rate=""0.5"" complexity=""537"">
<classes>
<class name="".LargeClass"" filename=""C:\Users\tonyh\source\repos\DemoOpenCover\DemoOpenCover\LargeClass.cs"" line-rate=""1"" branch-rate=""1"" complexity=""501"">
<methods>
<method name=""Method0"" signature=""()"" line-rate=""1"" branch-rate=""1"" complexity=""1"">
<lines>
<line number=""1"" hits=""1"" branch=""false"" />
</lines>
</method>
</methods>
<lines>
<line number=""1"" hits=""1"" branch=""true"" />
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
";

string fileName = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".xml";
File.WriteAllText(fileName, cobertura);
var report = new CoberturaDerializer().Deserialize(fileName);
var package = report.Packages.Single();
Assert.AreEqual("DemoOpenCover", package.Name);
var packageClass = package.Classes.Single();
Assert.AreEqual(".LargeClass", packageClass.Name);
Assert.AreEqual(@"C:\Users\tonyh\source\repos\DemoOpenCover\DemoOpenCover\LargeClass.cs", packageClass.Filename);
Assert.AreEqual(1, packageClass.LineRate);
Assert.AreEqual(1, packageClass.BranchRate);
Assert.AreEqual(501, packageClass.Complexity);
var method = packageClass.Methods.Single();
Assert.AreEqual("Method0", method.Name);
Assert.AreEqual("()", method.Signature);
Assert.AreEqual(1, method.LineRate);
Assert.AreEqual(1, method.BranchRate);
var line = method.Lines.Single();
Assert.AreEqual(1, line.Number);
Assert.AreEqual(1, line.Hits);
line = packageClass.Lines.Single();
Assert.AreEqual(1, line.Number);
Assert.AreEqual(1, line.Hits);
}
}
}

0 comments on commit e4ffb5d

Please sign in to comment.