Skip to content

Commit

Permalink
Pluralizer refactor (#31)
Browse files Browse the repository at this point in the history
* added inline exception support
* Code cleanup
* fixed tests
* spelling fixes
* updated readme
* updated versions and workflows
* added builder pattern for comments
* bug fix for summary comments
* Bug fix type paramRef
* Bug fix multi type param parsing in string
* Bug fixes
* Added error handling
* bug fix IsVerb
  • Loading branch information
d1820 authored Feb 14, 2024
1 parent 89d84d4 commit 87f927a
Show file tree
Hide file tree
Showing 166 changed files with 5,249 additions and 3,010 deletions.
64 changes: 59 additions & 5 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,33 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types:
- published # Run the workflow when a new GitHub release is published

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
VisxDirectory: ${{github.workspace}}/vsix
Version: '2.1.0.${{ github.run_number }}'
BaseVersion: '2.1.0.0'

defaults:
run:
shell: pwsh

jobs:
build:

runs-on: [windows-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer

- name: Setup MsBuild
uses: microsoft/setup-msbuild@v1.3.1
uses: microsoft/setup-msbuild@v2

- name: Setup VSTest.console.exe
# You may pin to the exact commit or the version.
Expand All @@ -28,13 +44,51 @@ jobs:
- name: Setup NuGet.exe
# You may pin to the exact commit or the version.
# uses: NuGet/setup-nuget@296fd3ccf8528660c91106efefe2364482f86d6f
uses: NuGet/[email protected]
uses: NuGet/[email protected]

- name: Update Visual Studio Extension version
uses: cezarypiatek/[email protected]
with:
version: ${{ env.Version }}
vsix-manifest-file: 'Manifests\vs2022\source.extension.vsixmanifest'

- name: Update assembly version
run: |
(Get-Content -Path CodeDocumentor\Settings\VsixOptions.cs) |
ForEach-Object {$_ -Replace '${{ env.BaseVersion }}', '${{ env.Version }}'} |
Set-Content -Path CodeDocumentor\Settings\VsixOptions.cs
- name: Restore dependencies
run: nuget restore CodeDocumentor.sln

- name: Build
run: msbuild CodeDocumentor.sln /p:platform="Any CPU" /p:configuration="Debug"
run: msbuild CodeDocumentor.sln /p:configuration="Release" /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal

- name: Test
run: vstest.console.exe CodeDocumentor.Test\bin\Debug\net48\CodeDocumentor.Test.dll
run: vstest.console.exe CodeDocumentor.Test\bin\Release\net48\CodeDocumentor.Test.dll

- uses: actions/[email protected]
name: "Pack"
with:
name: "CodeDocumentor.vsix"
path: CodeDocumentor\bin\Release\CodeDocumentor.vsix

deploy:
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# You can update this logic if you want to manage releases differently
if: github.event_name == 'release'
runs-on: [windows-latest]
needs: [ build ]
steps:
# Download the NuGet package created in the previous job
- uses: actions/[email protected]
with:
name: "CodeDocumentor.vsix"

- name: Publish extension to Marketplace
uses: cezarypiatek/[email protected]
with:
extension-file: 'CodeDocumentor.vsix'
publish-manifest-file: 'CodeDocumentor.vsix\manifest.json'
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}
43 changes: 43 additions & 0 deletions CodeDocumentor.Test/Builders/DocumentationBuilderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CodeDocumentor.Builders;
using CodeDocumentor.Helper;
using CodeDocumentor.Services;
using CodeDocumentor.Vsix2022;
using FluentAssertions;
using Microsoft.VisualStudio.TestPlatform.Utilities;
using Xunit;
using Xunit.Abstractions;

namespace CodeDocumentor.Test.Builders
{
[SuppressMessage("XMLDocumentation", "")]
public class DocumentationBuilderTests : IClassFixture<TestFixture>
{
private readonly TestFixture _fixture;
private readonly ITestOutputHelper _output;
private DocumentationBuilder _builder;

public DocumentationBuilderTests(TestFixture fixture, ITestOutputHelper output)
{
_fixture = fixture;
_output = output;
_fixture.Initialize(output);
_builder = new DocumentationBuilder();
Translator.Initialize(CodeDocumentorPackage.DIContainer().GetInstance<IOptionsService>());
}

[Fact]
public void CreateReturnComment__ReturnsValidNameWithStartingWord_WhenUseNaturalLanguageForReturnNodeIsTrue()
{
var method = TestFixture.BuildMethodDeclarationSyntax("TResult", "Tester");
var comment = _builder.WithReturnType(method).Build();
comment.Count.Should().Be(3);
comment[1].ToFullString().Should().Be(@"<returns>A <typeparamref name=""TResult""/></returns>");
}
}
}
Loading

0 comments on commit 87f927a

Please sign in to comment.