diff --git a/.build/.build.csproj b/.build/.build.csproj index 859c216f5..343f8f5ec 100644 --- a/.build/.build.csproj +++ b/.build/.build.csproj @@ -4,11 +4,9 @@ Exe net8.0 false - + False CS0649;CS0169 - 1 - true diff --git a/.build/Solution.cs b/.build/Build.CI.cs similarity index 55% rename from .build/Solution.cs rename to .build/Build.CI.cs index 6bcbeab9a..3c53d7228 100644 --- a/.build/Solution.cs +++ b/.build/Build.CI.cs @@ -3,44 +3,21 @@ using Rocket.Surgery.Nuke.ContinuousIntegration; using Rocket.Surgery.Nuke.DotNetCore; using Rocket.Surgery.Nuke.GithubActions; +using Rocket.Surgery.Nuke.Jobs; -namespace Build; - -internal class LocalConstants -{ - public static string[] PathsIgnore => new[] - { - ".codecov.yml", - ".editorconfig", - ".gitattributes", - ".gitignore", - ".gitmodules", - ".lintstagedrc.js", - ".prettierignore", - ".prettierrc", - "LICENSE", - "nukeeper.settings.json", - "omnisharp.json", - "package-lock.json", - "package.json", - "Readme.md", - ".github/dependabot.yml", - ".github/labels.yml", - ".github/release.yml", - ".github/renovate.json", - }; -} +#pragma warning disable CA1050 [GitHubActionsSteps( "ci-ignore", + GitHubActionsImage.MacOsLatest, GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest, AutoGenerate = false, - On = new[] { RocketSurgeonGitHubActionsTrigger.Push }, - OnPushTags = new[] { "v*" }, - OnPushBranches = new[] { "master", "main", "next" }, - OnPullRequestBranches = new[] { "master", "main", "next" }, - Enhancements = new[] { nameof(CiIgnoreMiddleware) } + On = [RocketSurgeonGitHubActionsTrigger.Push], + OnPushTags = ["v*"], + OnPushBranches = ["master", "main", "next"], + OnPullRequestBranches = ["master", "main", "next"], + Enhancements = [nameof(CiIgnoreMiddleware)] )] [GitHubActionsSteps( "ci", @@ -48,37 +25,36 @@ internal class LocalConstants GitHubActionsImage.WindowsLatest, GitHubActionsImage.UbuntuLatest, AutoGenerate = false, - On = new[] { RocketSurgeonGitHubActionsTrigger.Push }, - OnPushTags = new[] { "v*" }, - OnPushBranches = new[] { "master", "main", "next" }, - OnPullRequestBranches = new[] { "master", "main", "next" }, - InvokedTargets = new[] { nameof(Default) }, - NonEntryTargets = new[] - { + On = [RocketSurgeonGitHubActionsTrigger.Push], + OnPushTags = ["v*"], + OnPushBranches = ["master", "main", "next"], + OnPullRequestBranches = ["master", "main", "next"], + InvokedTargets = [nameof(Default)], + NonEntryTargets = [ nameof(ICIEnvironment.CIEnvironment), - nameof(ITriggerCodeCoverageReports.TriggerCodeCoverageReports), nameof(ITriggerCodeCoverageReports.GenerateCodeCoverageReportCobertura), nameof(IGenerateCodeCoverageBadges.GenerateCodeCoverageBadges), nameof(IGenerateCodeCoverageReport.GenerateCodeCoverageReport), nameof(IGenerateCodeCoverageSummary.GenerateCodeCoverageSummary), - nameof(Default) - }, - ExcludedTargets = new[] { nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore) }, - Enhancements = new[] { nameof(CiMiddleware) } + nameof(Default), + ], + ExcludedTargets = [nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore)], + Enhancements = [nameof(CiMiddleware)] )] +[CloseMilestoneJob(AutoGenerate = false)] +[DraftReleaseJob(AutoGenerate = false)] +[UpdateMilestoneJob(AutoGenerate = false)] [PrintBuildVersion] [PrintCIEnvironment] [UploadLogs] [TitleEvents] [ContinuousIntegrationConventions] -public partial class Solution +internal sealed partial class Pipeline { public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware( RocketSurgeonGitHubActionsConfiguration configuration ) { - configuration.IncludeRepositoryConfigurationFiles(); - ( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps = new List { new RunStep("N/A") @@ -87,7 +63,7 @@ RocketSurgeonGitHubActionsConfiguration configuration } }; - return configuration; + return configuration.IncludeRepositoryConfigurationFiles(); } public static RocketSurgeonGitHubActionsConfiguration CiMiddleware( @@ -96,33 +72,32 @@ RocketSurgeonGitHubActionsConfiguration configuration { configuration .ExcludeRepositoryConfigurationFiles() - .AddNugetPublish() .Jobs.OfType() .First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase)) .ConfigureStep(step => step.FetchDepth = 0) - .UseDotNetSdks("3.1", "6.0", "8.0", "9.0") + .UseDotNetSdks("6.0", "8.0", "9.0") .AddNuGetCache() .AddVscodeExtensionTests() - .PublishLogs() - .PublishArtifacts() + .PublishLogs() + .PublishArtifacts() .FailFast = false; return configuration; } } -public static class Extensions +public static class JobExtensions { public static RocketSurgeonsGithubActionsJob AddVscodeExtensionTests(this RocketSurgeonsGithubActionsJob job) { return job .AddStep(new RunStep("Npm install") { Run = "npm ci", - WorkingDirectory = Solution.VscodeTestExtensionProjectDirectory + WorkingDirectory = Pipeline.VscodeTestExtensionProjectDirectory }) .AddStep(new HeadlessRunStep("Vscode extension tests") { Run = "npm run test", - WorkingDirectory = Solution.VscodeTestExtensionProjectDirectory + WorkingDirectory = Pipeline.VscodeTestExtensionProjectDirectory }); } } diff --git a/.build/Build.cs b/.build/Build.cs index 8097b5d06..651fd35b7 100644 --- a/.build/Build.cs +++ b/.build/Build.cs @@ -1,8 +1,8 @@ using JetBrains.Annotations; using Nuke.Common; +using Nuke.Common.CI; using Nuke.Common.Execution; using Nuke.Common.Git; -using Nuke.Common.IO; using Nuke.Common.Tooling; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.GitVersion; @@ -10,28 +10,26 @@ using Nuke.Common.Tools.Npm; using Rocket.Surgery.Nuke.DotNetCore; -namespace Build; +#pragma warning disable CA1050 [PublicAPI] [UnsetVisualStudioEnvironmentVariables] [PackageIcon("http://www.omnisharp.net/images/logo.png")] -[EnsureReadmeIsUpdated] [DotNetVerbosityMapping] [MSBuildVerbosityMapping] [NuGetVerbosityMapping] +[ShutdownDotNetAfterServerBuild] [LocalBuildConventions] -public sealed partial class Solution : NukeBuild, +internal sealed partial class Pipeline : NukeBuild, ICanRestoreWithDotNetCore, ICanBuildWithDotNetCore, ICanTestWithDotNetCore, ICanPackWithDotNetCore, - IHaveDataCollector, ICanClean, - ICanUpdateReadme, + IHavePublicApis, IGenerateCodeCoverageReport, IGenerateCodeCoverageSummary, IGenerateCodeCoverageBadges, - IGenerateDocFx, IHaveConfiguration { /// @@ -41,29 +39,39 @@ public sealed partial class Solution : NukeBuild, /// - Microsoft VisualStudio https://nuke.build/visualstudio /// - Microsoft VSCode https://nuke.build/vscode /// - public static int Main() => Execute(x => x.Default); + public static int Main() => Execute(x => x.Default); - [OptionalGitRepository] public GitRepository? GitRepository { get; } + public Target Build => _ => _; - private Target Default => _ => _ - .DependsOn(Restore) - .DependsOn(Build) - .DependsOn(Test) - .DependsOn(Pack); + public Target Clean => _ => _; + + [Parameter("Configuration to build")] + public Configuration Configuration { get; } = IsLocalBuild ? Configuration.Debug : Configuration.Release; - public Target Build => _ => _.Inherit(x => x.CoreBuild); + [OptionalGitRepository] + public GitRepository? GitRepository { get; } - public Target Pack => _ => _.Inherit(x => x.CorePack) - .DependsOn(Clean); + [GitVersion(NoFetch = true, NoCache = false)] + public GitVersion GitVersion { get; } = null!; - [ComputedGitVersion] public GitVersion GitVersion { get; } = null!; + public Target Lint => _ => _; - public Target Clean => _ => _.Inherit(x => x.Clean); - public Target Restore => _ => _.Inherit(x => x.CoreRestore); + public Target Pack => _ => _.DependsOn(Clean); - public Target Test => _ => _.Inherit(x => x.CoreTest); + public Target Restore => _ => _; + public Target Test => _ => _; + + [NonEntryTarget] + private Target Default => _ => _ + .DependsOn(Restore) + .DependsOn(Build) + .DependsOn(Test) + .DependsOn(Pack); + +#pragma warning disable CA1822 public Target NpmInstall => _ => _ +#pragma warning restore CA1822 // Member 'NpmInstall' does not access instance data and can be marked as static .Executes(() => NpmTasks.NpmCi(s => s .SetProcessWorkingDirectory(VscodeTestExtensionProjectDirectory))); @@ -75,13 +83,7 @@ public sealed partial class Solution : NukeBuild, .SetProcessWorkingDirectory(VscodeTestExtensionProjectDirectory) .SetCommand("test"))); - public Target BuildVersion => _ => _.Inherit(x => x.BuildVersion) - .Before(Default) - .Before(Clean); - - [Parameter("Configuration to build")] public Configuration Configuration { get; } = IsLocalBuild ? Configuration.Debug : Configuration.Release; - - AbsolutePath ICanUpdateReadme.ReadmeFilePath => RootDirectory / "README.md"; + public Target BuildVersion => _ => _.Before(Default).Before(Clean); internal const string VscodeTestExtensionProjectDirectory = "vscode-testextension"; } diff --git a/.build/Configuration.cs b/.build/Configuration.cs index 6f2fcceaf..39145e725 100644 --- a/.build/Configuration.cs +++ b/.build/Configuration.cs @@ -1,13 +1,13 @@ ο»Ώusing System.ComponentModel; using Nuke.Common.Tooling; -namespace Build; +#pragma warning disable CA1050, CA1724, CA2225 [TypeConverter(typeof(TypeConverter))] public class Configuration : Enumeration { - public static Configuration Debug = new() { Value = nameof(Debug) }; - public static Configuration Release = new() { Value = nameof(Release) }; + public static readonly Configuration Debug = new() { Value = nameof(Debug) }; + public static readonly Configuration Release = new() { Value = nameof(Release) }; public static implicit operator string(Configuration configuration) => configuration.Value; } diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 109b0cded..b078b9dba 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -1,42 +1,69 @@ { - "version": 1, - "isRoot": true, - "tools": { - "dotnet-outdated": { - "version": "2.11.0", - "commands": [ - "dotnet-outdated" - ] - }, - "dotnet-reportgenerator-globaltool": { - "version": "5.4.4", - "commands": [ - "reportgenerator" - ] - }, - "nuke.globaltool": { - "version": "9.0.4", - "commands": [ - "nuke" - ] - }, - "codecov.tool": { - "version": "1.13.0", - "commands": [ - "codecov" - ] - }, - "jetbrains.resharper.globaltools": { - "version": "2024.3.5", - "commands": [ - "jb" - ] - }, - "nukeeper": { - "version": "0.35.0", - "commands": [ - "nukeeper" - ] - } + "version": 1, + "isRoot": true, + "tools": { + "dotnet-outdated": { + "version": "2.11.0", + "commands": [ + "dotnet-outdated" + ], + "rollForward": false + }, + "dotnet-reportgenerator-globaltool": { + "version": "5.4.4", + "commands": [ + "reportgenerator" + ], + "rollForward": false + }, + "nuke.globaltool": { + "version": "9.0.4", + "commands": [ + "nuke" + ], + "rollForward": false + }, + "codecov.tool": { + "version": "1.13.0", + "commands": [ + "codecov" + ], + "rollForward": false + }, + "jetbrains.resharper.globaltools": { + "version": "2024.3.5", + "commands": [ + "jb" + ], + "rollForward": false + }, + "nukeeper": { + "version": "0.35.0", + "commands": [ + "nukeeper" + ], + "rollForward": false + }, + "dotnet-coverage": { + "version": "17.13.1", + "commands": [ + "dotnet-coverage" + ], + "rollForward": false + }, + "gitreleasemanager.tool": { + "version": "0.18.0", + "commands": [ + "dotnet-gitreleasemanager" + ], + "rollForward": false + }, + "gitversion.tool": { + "version": "6.1.0", + "commands": [ + "dotnet-gitversion" + ], + "rollForward": false } -} + } +} \ No newline at end of file diff --git a/.github/workflows/ci-ignore.yml b/.github/workflows/ci-ignore.yml index 1826f2ffc..b48765ee3 100644 --- a/.github/workflows/ci-ignore.yml +++ b/.github/workflows/ci-ignore.yml @@ -67,6 +67,20 @@ on: - '.github/labels.yml' - '.github/release.yml' - '.github/renovate.json' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: build: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4e527ddb..ca6725a71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,11 +67,39 @@ on: - '.github/labels.yml' - '.github/release.yml' - '.github/renovate.json' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: build: env: NUGET_PACKAGES: '${{ github.workspace }}/.nuget/packages' + permissions: + actions: read + checks: write + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write strategy: fail-fast: false matrix: @@ -89,10 +117,6 @@ jobs: with: path: '${{ github.workspace }}/.nuget/packages' key: "${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/dotnet-tools.json') }}" - - name: πŸ”¨ Use .NET Core 3.1 SDK - uses: actions/setup-dotnet@v4.3.0 - with: - dotnet-version: '3.1.x' - name: πŸ”¨ Use .NET Core 6.0 SDK uses: actions/setup-dotnet@v4.3.0 with: @@ -105,74 +129,87 @@ jobs: uses: actions/setup-dotnet@v4.3.0 with: dotnet-version: '9.0.x' - - name: 🎁 dotnet tool restore + - name: πŸš’ dotnet workload restore + continue-on-error: true + run: | + dotnet workload restore + - name: βš’οΈ dotnet tool restore run: | dotnet tool restore - name: 🎁 Restore id: restore run: | - dotnet nuke Restore --skip + dotnet nuke --target DotnetCoreRestore Restore - name: Update NuGet Cache if: always() && steps.restore-nuget-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: key: "${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/dotnet-tools.json') }}" path: '${{ github.workspace }}/.nuget/packages' - - name: βš™ Build + - name: βš™οΈ Build id: build run: | - dotnet nuke Build --skip - - name: 🚦 Test + dotnet .build/bin/Debug/.build.dll --target DotnetCoreBuild Build + - name: πŸ’¨ Test id: test run: | - dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip + dotnet .build/bin/Debug/.build.dll --target DotnetCoreTest Test CollectCodeCoverage GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport - name: πŸ“¦ Pack id: pack run: | - dotnet nuke Pack --skip + dotnet .build/bin/Debug/.build.dll --target DotnetCorePack Pack --skip Build - name: Npm install working-directory: vscode-testextension run: | npm ci - - name: 🚦 Vscode extension tests + - name: πŸ’¨ Vscode extension tests uses: coactions/setup-xvfb@v1 with: run: 'npm run test' working-directory: 'vscode-testextension' - - name: 🏺 Publish coverage data - if: always() - uses: actions/upload-artifact@v4 - with: - name: 'coverage-${{ matrix.os }}' - path: 'coverage/' - - name: 🐿 Publish Coverage - if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]') - uses: codecov/codecov-action@v4.0.0-beta.2 - with: - name: 'actions-${{ matrix.os }}' - - name: 🏺 Publish logs + - name: 🏺 Publish logs (${{ matrix.os }}) if: always() uses: actions/upload-artifact@v4 with: name: 'logs-${{ matrix.os }}' - path: 'artifacts/logs/' - - name: 🏺 Publish test data + path: '${{ github.workspace }}/artifacts/logs/' + - name: 🏺 Publish test data (${{ matrix.os }}) if: always() uses: actions/upload-artifact@v4 with: name: 'test data-${{ matrix.os }}' - path: 'artifacts/test/' - - name: 🏺 Publish NuGet Packages + path: '${{ github.workspace }}/artifacts/test/' + - name: πŸš€ Publish Test Results + if: always() && matrix.os == 'macos-latest' + uses: EnricoMi/publish-unit-test-result-action/macos@v2 + with: + files: '${{ github.workspace }}/artifacts/test/**/*.trx' + - name: 🏺 Publish coverage data (${{ matrix.os }}) if: always() uses: actions/upload-artifact@v4 with: - name: 'nuget-${{ matrix.os }}' - path: 'artifacts/nuget/' - - name: 🏺 Publish Documentation + name: 'coverage-${{ matrix.os }}' + path: '${{ github.workspace }}/coverage/' + - name: πŸš€ Publish Coverage Comment + if: always() && github.event_name == 'pull_request' + continue-on-error: true + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: 'Coverage' + path: '${{ github.workspace }}/coverage/summary/SummaryGithub.md' + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + - name: πŸš€ Publish Codecov Coverage + if: always() && (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]') + continue-on-error: true + uses: codecov/codecov-action@v4.0.0-beta.2 + with: + name: 'actions-${{ matrix.os }}' + - name: 🏺 Publish NuGet Packages (${{ matrix.os }}) + if: always() uses: actions/upload-artifact@v4 with: - name: 'docs-${{ matrix.os }}' - path: 'artifacts/docs/' + name: 'nuget-${{ matrix.os }}' + path: '${{ github.workspace }}/artifacts/nuget/' Merge: runs-on: ubuntu-latest needs: build diff --git a/.github/workflows/close-milestone.yml b/.github/workflows/close-milestone.yml index 0cff1b3c8..50a616814 100644 --- a/.github/workflows/close-milestone.yml +++ b/.github/workflows/close-milestone.yml @@ -1,9 +1,39 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [CloseMilestoneJob (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# nuke --generate-configuration GitHubActions_close-milestone --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + name: Close Milestone on: release: types: - released +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: close_milestone: @@ -12,56 +42,55 @@ jobs: - name: Checkout uses: actions/checkout@v4.2.2 with: - fetch-depth: 0 - - - uses: actions/setup-dotnet@v4 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v3.1.11 - with: - versionSpec: '6.0.x' - preferLatestVersion: true - - - name: Install GitReleaseManager - uses: gittools/actions/gitreleasemanager/setup@v3.1.11 - with: - versionSpec: '0.18.x' - - - name: Use GitVersion + clean: 'false' + fetch-depth: '0' + - name: Fetch all history for all tags and branches + run: | + git fetch --prune + - name: πŸ“² Install DotNet + uses: actions/setup-dotnet@v4 + - name: βš’οΈ dotnet tool restore + run: | + dotnet tool restore + - name: πŸ”¨ Use GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v3.1.11 - - # Ensure the milestone exists + shell: pwsh + run: | + $data = dotnet gitversion | ConvertFrom-Json + foreach ($item in $data.PSObject.Properties) { + $key = $item.Name + $value = $item.Value + echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT + } - name: Create Milestone - uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: v${{ steps.gitversion.outputs.majorMinorPatch }} env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - continue-on-error: true - - # move any issues to that milestone in the event the release is renamed + uses: WyriHaximus/github-action-create-milestone@v1 + with: + title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' - name: sync milestones uses: RocketSurgeonsGuild/actions/sync-milestone@v0.3.15 with: - default-label: 'mysterious' - github-token: ${{ secrets.OMNISHARP_BOT_TOKEN }} - + default-label: ':sparkles: mysterious' + github-token: '${{ secrets.GITHUB_TOKEN }}' + - name: πŸ“² Install GitReleaseManager + uses: gittools/actions/gitreleasemanager/setup@v3.1.11 + with: + versionSpec: '0.18.0' - name: Get Repo and Owner - shell: pwsh id: repository if: ${{ !github.event.release.prerelease && steps.gitversion.outputs.preReleaseTag == '' }} + shell: pwsh run: | $parts = $ENV:GITHUB_REPOSITORY.Split('/') echo "::set-output name=owner::$($parts[0])" echo "::set-output name=repository::$($parts[1])" - - name: Close Milestone - shell: pwsh if: ${{ !github.event.release.prerelease && steps.gitversion.outputs.preReleaseTag == '' }} + shell: pwsh run: | dotnet gitreleasemanager close ` - -o "${{ steps.repository.outputs.owner }}" ` - -r "${{ steps.repository.outputs.repository }}" ` - --token "${{ secrets.GITHUB_TOKEN }}" ` - -m "v${{ steps.gitversion.outputs.majorMinorPatch }}" + -o "${{ steps.repository.outputs.owner }}" ` + -r "${{ steps.repository.outputs.repository }}" ` + --token "${{ secrets.GITHUB_TOKEN }}" ` + -m "v${{ steps.gitversion.outputs.majorMinorPatch }}" diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 7f595dca9..84c30e88a 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -1,16 +1,46 @@ -name: Create Milestone and Draft Release +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [DraftReleaseJob (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# nuke --generate-configuration GitHubActions_draft-release --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + +name: Draft Release and Create Milestone on: push: branches: - - master + - 'master' paths-ignore: - '**/*.md' schedule: - cron: '0 0 * * 4' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: - create_milestone_and_draft_release: + draft_release: permissions: # write permission is required to create a github release contents: write @@ -19,44 +49,48 @@ jobs: - name: Checkout uses: actions/checkout@v4.2.2 with: - fetch-depth: 0 - - - uses: actions/setup-dotnet@v4 - + clean: 'false' + fetch-depth: '0' - name: Fetch all history for all tags and branches - run: git fetch --prune - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v3.1.11 - with: - versionSpec: '6.0.x' - preferLatestVersion: true - - - name: Use GitVersion + run: | + git fetch --prune + - name: πŸ“² Install DotNet + uses: actions/setup-dotnet@v4 + - name: βš’οΈ dotnet tool restore + run: | + dotnet tool restore + - name: πŸ”¨ Use GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v3.1.11 - + shell: pwsh + run: | + $data = dotnet gitversion | ConvertFrom-Json + foreach ($item in $data.PSObject.Properties) { + $key = $item.Name + $value = $item.Value + echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT + } - name: Create Milestone - uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: v${{ steps.gitversion.outputs.majorMinorPatch }} env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - continue-on-error: true - - - name: sync milestones + uses: WyriHaximus/github-action-create-milestone@v1 + with: + title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' + - name: Sync Milestones uses: RocketSurgeonsGuild/actions/sync-milestone@v0.3.15 with: - default-label: 'mysterious' - github-token: ${{ secrets.GITHUB_TOKEN }} - - - uses: ncipollo/release-action@v1 + default-label: ':sparkles: mysterious' + github-token: '${{ secrets.GITHUB_TOKEN }}' + - name: Create Release + uses: ncipollo/release-action@v1 with: - allowUpdates: true - generateReleaseNotes: true - draft: true - omitNameDuringUpdate: true + allowUpdates: 'true' + generateReleaseNotes: 'true' + updateOnlyUnreleased: 'true' + draft: 'true' + omitBodyDuringUpdate: 'true' + omitNameDuringUpdate: 'true' + omitDraftDuringUpdate: 'true' name: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' tag: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' - token: ${{ secrets.GITHUB_TOKEN }} - commit: ${{ github.base_ref }} + token: '${{ secrets.GITHUB_TOKEN }}' + commit: '${{ github.base_ref }}' diff --git a/.github/workflows/update-milestone.yml b/.github/workflows/update-milestone.yml index 8aa210765..4b6205777 100644 --- a/.github/workflows/update-milestone.yml +++ b/.github/workflows/update-milestone.yml @@ -1,12 +1,43 @@ +# ------------------------------------------------------------------------------ +# +# +# This code was generated. +# +# - To turn off auto-generation set: +# +# [UpdateMilestoneJob (AutoGenerate = false)] +# +# - To trigger manual generation invoke: +# +# nuke --generate-configuration GitHubActions_update-milestone --host GitHubActions +# +# +# ------------------------------------------------------------------------------ + name: Update Milestone on: + push: pull_request_target: types: - - closed - - opened - - reopened - - synchronize + - 'closed' + - 'opened' + - 'reopened' + - 'synchronize' +permissions: + actions: read + checks: read + contents: read + deployments: read + id-token: none + issues: write + discussions: none + packages: none + pages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: write jobs: update_milestone: @@ -15,43 +46,34 @@ jobs: - name: Checkout uses: actions/checkout@v4.2.2 with: - ref: ${{ github.sha }} - fetch-depth: 0 - - - uses: actions/setup-dotnet@v4 - + clean: 'false' + fetch-depth: '0' - name: Fetch all history for all tags and branches - run: git fetch --prune - - - name: Install GitVersion - if: ${{ github.event.action == 'opened' }} - uses: gittools/actions/gitversion/setup@v3.1.11 - with: - versionSpec: '6.0.x' - preferLatestVersion: true - - - name: Install GitReleaseManager - if: ${{ github.event.action == 'opened' }} - uses: gittools/actions/gitreleasemanager/setup@v3.1.11 - with: - versionSpec: '0.18.x' - - - name: Use GitVersion - if: ${{ github.event.action == 'opened' }} + run: | + git fetch --prune + - name: πŸ“² Install DotNet + uses: actions/setup-dotnet@v4 + - name: βš’οΈ dotnet tool restore + run: | + dotnet tool restore + - name: πŸ”¨ Use GitVersion id: gitversion - uses: gittools/actions/gitversion/execute@v3.1.11 - + shell: pwsh + run: | + $data = dotnet gitversion | ConvertFrom-Json + foreach ($item in $data.PSObject.Properties) { + $key = $item.Name + $value = $item.Value + echo "$($key.Substring(0,1).ToLower() + $key.Substring(1))=$value" >> $env:GITHUB_OUTPUT + } - name: Create Milestone - if: ${{ github.event.action == 'opened' }} - uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: v${{ steps.gitversion.outputs.majorMinorPatch }} env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - continue-on-error: true - - - name: sync milestones + uses: WyriHaximus/github-action-create-milestone@v1 + with: + title: 'v${{ steps.gitversion.outputs.majorMinorPatch }}' + - name: Sync Milestones uses: RocketSurgeonsGuild/actions/sync-milestone@v0.3.15 with: - default-label: 'mysterious' - github-token: ${{ secrets.GITHUB_TOKEN }} + default-label: ':sparkles: mysterious' + github-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.gitignore b/.gitignore index 99a0f4a92..866dd2678 100644 --- a/.gitignore +++ b/.gitignore @@ -41,8 +41,8 @@ tools/*/ .idea/ node_modules/ coverage.*.xml -coverage.json -coverage.info +coverage.*.json +coverage.*.info /codealike.json .tmp/ .nuke/temp/ diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index e18c1f5f0..cc7d21694 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -1,55 +1,82 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", "definitions": { - "build": { - "type": "object", + "Host": { + "type": "string", + "enum": [ + "AppVeyor", + "AzurePipelines", + "Bamboo", + "Bitbucket", + "Bitrise", + "GitHubActions", + "GitLab", + "Jenkins", + "Rider", + "SpaceAutomation", + "TeamCity", + "Terminal", + "TravisCI", + "VisualStudio", + "VSCode" + ] + }, + "ExecutableTarget": { + "type": "string", + "enum": [ + "Build", + "BuildVersion", + "Clean", + "CleanWellKnownTemporaryFiles", + "CollectCodeCoverage", + "Default", + "DotnetCoreBuild", + "DotnetCorePack", + "DotnetCoreRestore", + "DotnetCoreTest", + "DotnetToolRestore", + "GenerateCodeCoverageBadges", + "GenerateCodeCoverageReport", + "GenerateCodeCoverageReportCobertura", + "GenerateCodeCoverageSummary", + "HuskyLint", + "Lint", + "LintFiles", + "LintGitAdd", + "LintPublicApiAnalyzers", + "MoveUnshippedToShipped", + "NpmInstall", + "Pack", + "PostLint", + "Restore", + "ShipPublicApis", + "Test", + "TestVscodeExtension" + ] + }, + "Verbosity": { + "type": "string", + "description": "", + "enum": [ + "Verbose", + "Normal", + "Minimal", + "Quiet" + ] + }, + "NukeBuild": { "properties": { - "Artifacts": { - "type": "string", - "description": "The directory where artifacts are to be dropped" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build", - "enum": [ - "Debug", - "Release" - ] - }, "Continue": { "type": "boolean", "description": "Indicates to continue a previously failed build attempt" }, - "Coverage": { - "type": "string", - "description": "The directory where coverage artifacts are to be dropped" - }, "Help": { "type": "boolean", "description": "Shows the help text for this build assembly" }, "Host": { - "type": "string", "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] + "$ref": "#/definitions/Host" }, "NoLogo": { "type": "boolean", @@ -74,95 +101,61 @@ "type": "string", "description": "Root directory during build execution" }, - "Serve": { - "type": "boolean", - "description": "serve the docs" - }, "Skip": { "type": "array", "description": "List of targets to be skipped. Empty list skips all dependencies", "items": { - "type": "string", - "enum": [ - "Build", - "BuildVersion", - "Clean", - "CoreBuild", - "CoreDocs", - "CorePack", - "CoreRestore", - "CoreTest", - "Default", - "DotnetToolRestore", - "Generate_Code_Coverage_Badges", - "Generate_Code_Coverage_Report", - "Generate_Code_Coverage_Report_Cobertura", - "Generate_Code_Coverage_Summary", - "GenerateCodeCoverageBadges", - "GenerateCodeCoverageReport", - "GenerateCodeCoverageReportCobertura", - "GenerateCodeCoverageSummary", - "GenerateReadme", - "NpmInstall", - "Pack", - "Restore", - "Test", - "TestVscodeTestExtension", - "Trigger_Code_Coverage_Reports", - "TriggerCodeCoverageReports" - ] + "$ref": "#/definitions/ExecutableTarget" } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", "items": { - "type": "string", - "enum": [ - "Build", - "BuildVersion", - "Clean", - "CoreBuild", - "CoreDocs", - "CorePack", - "CoreRestore", - "CoreTest", - "Default", - "DotnetToolRestore", - "Generate_Code_Coverage_Badges", - "Generate_Code_Coverage_Report", - "Generate_Code_Coverage_Report_Cobertura", - "Generate_Code_Coverage_Summary", - "GenerateCodeCoverageBadges", - "GenerateCodeCoverageReport", - "GenerateCodeCoverageReportCobertura", - "GenerateCodeCoverageSummary", - "GenerateReadme", - "NpmInstall", - "Pack", - "Restore", - "Test", - "TestVscodeTestExtension", - "Trigger_Code_Coverage_Reports", - "TriggerCodeCoverageReports" - ] + "$ref": "#/definitions/ExecutableTarget" } }, "Verbosity": { - "type": "string", "description": "Logging verbosity during build execution. Default is 'Normal'", + "$ref": "#/definitions/Verbosity" + } + } + } + }, + "allOf": [ + { + "properties": { + "Artifacts": { + "type": "string", + "description": "The directory where artifacts are to be dropped" + }, + "Configuration": { + "type": "string", + "description": "Configuration to build", "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" + "Debug", + "Release" ] + }, + "Coverage": { + "type": "string", + "description": "The directory where coverage artifacts are to be dropped" + }, + "lint-files": { + "type": "array", + "description": "The files to lint, if not given lints all files", + "items": { + "type": "string" + } + }, + "Solution": { + "type": "string", + "description": "Path to a solution file that is automatically loaded" } } + }, + { + "$ref": "#/definitions/NukeBuild" } - } + ] } diff --git a/.nuke/parameters.json b/.nuke/parameters.json index 2d4a451b6..2616d8357 100644 --- a/.nuke/parameters.json +++ b/.nuke/parameters.json @@ -1,4 +1,5 @@ { "$schema": "./build.schema.json", - "Solution": "LSP.sln" -} \ No newline at end of file + "Solution": "LSP.sln", + "Host": "GitHubActions" +} diff --git a/Directory.Build.props b/Directory.Build.props index c824ab2bf..004d3bb90 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -21,14 +21,16 @@ 1 true enable + + true + $(NoWarn);CS4014 true true snupkg true - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb $(AllowedReferenceRelatedFileExtensions);.pdb diff --git a/Directory.Packages.props b/Directory.Packages.props index d54ec7bea..abfa3a0f9 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -24,7 +24,7 @@ - + diff --git a/sample/SampleServer/Program.cs b/sample/SampleServer/Program.cs index 999932d2a..d338ae7a5 100644 --- a/sample/SampleServer/Program.cs +++ b/sample/SampleServer/Program.cs @@ -8,6 +8,8 @@ using OmniSharp.Extensions.LanguageServer.Server; using Serilog; +#nullable disable + // ReSharper disable UnusedParameter.Local namespace SampleServer diff --git a/sample/SampleServer/SemanticTokensHandler.cs b/sample/SampleServer/SemanticTokensHandler.cs index 0f8c3d517..363f9e575 100644 --- a/sample/SampleServer/SemanticTokensHandler.cs +++ b/sample/SampleServer/SemanticTokensHandler.cs @@ -10,6 +10,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +#nullable disable + namespace SampleServer { #pragma warning disable 618 @@ -22,7 +24,7 @@ public SemanticTokensHandler(ILogger logger) _logger = logger; } - public override async Task Handle( + public override async Task Handle( SemanticTokensParams request, CancellationToken cancellationToken ) { @@ -30,7 +32,7 @@ public SemanticTokensHandler(ILogger logger) return result; } - public override async Task Handle( + public override async Task Handle( SemanticTokensRangeParams request, CancellationToken cancellationToken ) { @@ -38,7 +40,7 @@ public SemanticTokensHandler(ILogger logger) return result; } - public override async Task Handle( + public override async Task Handle( SemanticTokensDeltaParams request, CancellationToken cancellationToken ) diff --git a/sample/SampleServer/TextDocumentHandler.cs b/sample/SampleServer/TextDocumentHandler.cs index e9a06b74a..2c71fd2c2 100644 --- a/sample/SampleServer/TextDocumentHandler.cs +++ b/sample/SampleServer/TextDocumentHandler.cs @@ -15,6 +15,7 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Workspace; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; +#nullable disable #pragma warning disable CS0618 diff --git a/src/Protocol/Features/Workspace/ExecuteCommandFeature.cs b/src/Protocol/Features/Workspace/ExecuteCommandFeature.cs index 1b69c1085..e500af6df 100644 --- a/src/Protocol/Features/Workspace/ExecuteCommandFeature.cs +++ b/src/Protocol/Features/Workspace/ExecuteCommandFeature.cs @@ -17,6 +17,9 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Shared; using ISerializer = OmniSharp.Extensions.JsonRpc.ISerializer; +#nullable disable + +#pragma warning restore format // ReSharper disable once CheckNamespace namespace OmniSharp.Extensions.LanguageServer.Protocol { diff --git a/test/Client.Tests/ClientTests.cs b/test/Client.Tests/ClientTests.cs index 6c31d0426..7a99c574a 100644 --- a/test/Client.Tests/ClientTests.cs +++ b/test/Client.Tests/ClientTests.cs @@ -11,6 +11,7 @@ using Xunit.Abstractions; using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; +#nullable disable namespace OmniSharp.Extensions.LanguageServer.Client.Tests { @@ -686,8 +687,8 @@ public async Task Diagnostics_Success() var receivedDiagnosticsNotification = new TaskCompletionSource(); - DocumentUri? actualDocumentUri = null; - List? actualDiagnostics = null; + DocumentUri actualDocumentUri = null; + List actualDiagnostics = null; var (_, server) = await Initialize( clientOptions => diff --git a/test/Client.Tests/Logging/TestOutputLogger.cs b/test/Client.Tests/Logging/TestOutputLogger.cs index 95275aa31..aad4f4091 100644 --- a/test/Client.Tests/Logging/TestOutputLogger.cs +++ b/test/Client.Tests/Logging/TestOutputLogger.cs @@ -3,6 +3,8 @@ using Microsoft.Extensions.Logging; using Xunit.Abstractions; +#nullable disable + namespace OmniSharp.Extensions.LanguageServer.Client.Tests.Logging { /// @@ -101,7 +103,7 @@ public TestOutputLogger(ITestOutputHelper testOutput, string name, LogLevel mini /// /// A delegate that formats the log message. /// - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) { if (logLevel < _minimumLevel) return; diff --git a/test/Client.Tests/TestBase.cs b/test/Client.Tests/TestBase.cs index 2f43fce2c..c9bc8f976 100644 --- a/test/Client.Tests/TestBase.cs +++ b/test/Client.Tests/TestBase.cs @@ -8,6 +8,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace OmniSharp.Extensions.LanguageServer.Client.Tests { /// diff --git a/test/Dap.Tests/DapOutputHandlerTests.cs b/test/Dap.Tests/DapOutputHandlerTests.cs index 05f336aaa..a62bbd8f3 100644 --- a/test/Dap.Tests/DapOutputHandlerTests.cs +++ b/test/Dap.Tests/DapOutputHandlerTests.cs @@ -19,7 +19,9 @@ public class DapOutputHandlerTests private static OutputHandler NewHandler(PipeWriter writer) { return new OutputHandler( + #pragma warning disable CS0618 writer, new DapProtocolSerializer(), new[] { new AlwaysOutputFilter() }, Scheduler.Immediate, NullLogger.Instance + #pragma warning restore CS0618 ); } diff --git a/test/Dap.Tests/DebugAdapterSpecifictionRecieverTests.cs b/test/Dap.Tests/DebugAdapterSpecifictionRecieverTests.cs index 8abb164cf..47c18072d 100644 --- a/test/Dap.Tests/DebugAdapterSpecifictionRecieverTests.cs +++ b/test/Dap.Tests/DebugAdapterSpecifictionRecieverTests.cs @@ -17,8 +17,10 @@ public class DebugAdapterSpecificationReceiverTests public void ShouldRespond_AsExpected(string json, Renor[] request) { var receiver = new DapReceiver(); + #pragma warning disable CS0618 var inSerializer = new DapProtocolSerializer(); var outSerializer = new DapProtocolSerializer(); + #pragma warning restore CS0618 var (requests, _) = receiver.GetRequests(JToken.Parse(json)); var result = requests.ToArray(); request.Length.Should().Be(result.Length); @@ -36,7 +38,9 @@ public void ShouldRespond_AsExpected(string json, Renor[] request) [Fact] public void Should_Camel_Case_As_Expected() { + #pragma warning disable CS0618 var serializer = new DapProtocolSerializer(); + #pragma warning restore CS0618 var response = serializer.SerializeObject( new InitializeResponse { diff --git a/test/Dap.Tests/FoundationTests.cs b/test/Dap.Tests/FoundationTests.cs index a73c92d20..0e20c4960 100644 --- a/test/Dap.Tests/FoundationTests.cs +++ b/test/Dap.Tests/FoundationTests.cs @@ -21,6 +21,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Dap.Tests { public class FoundationTests diff --git a/test/Dap.Tests/Integration/Fixtures/DebugAdapterProtocolFixture.cs b/test/Dap.Tests/Integration/Fixtures/DebugAdapterProtocolFixture.cs index 2bd203431..3f5918657 100644 --- a/test/Dap.Tests/Integration/Fixtures/DebugAdapterProtocolFixture.cs +++ b/test/Dap.Tests/Integration/Fixtures/DebugAdapterProtocolFixture.cs @@ -10,6 +10,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Dap.Tests.Integration.Fixtures { public class DebugAdapterProtocolFixture : DebugAdapterProtocolTestBase, IAsyncLifetime diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 63d3d077a..928bf9d03 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -5,6 +5,7 @@ true true true + $(NoWarn);CS1998 [Omnisharp.*]* diff --git a/test/Generation.Tests/GenerationHelpers.cs b/test/Generation.Tests/GenerationHelpers.cs index 0726a2008..53ed3a3cf 100644 --- a/test/Generation.Tests/GenerationHelpers.cs +++ b/test/Generation.Tests/GenerationHelpers.cs @@ -20,6 +20,8 @@ //using OmniSharp.Extensions.DebugAdapter.Protocol.Client; //using OmniSharp.Extensions.LanguageServer.Protocol.Server; +#nullable disable + namespace Generation.Tests { public static class GenerationHelpers @@ -227,7 +229,7 @@ public NotSureWhatToCallYou(ISyntaxReceiver syntaxReceiver) _syntaxReceiver = syntaxReceiver; } - public override void Visit(SyntaxNode? node) + public override void Visit(SyntaxNode node) { if (node == null) return; _syntaxReceiver.OnVisitSyntaxNode(node); diff --git a/test/JsonRpc.Tests/InputHandlerTests.cs b/test/JsonRpc.Tests/InputHandlerTests.cs index ba93492d7..555da1425 100644 --- a/test/JsonRpc.Tests/InputHandlerTests.cs +++ b/test/JsonRpc.Tests/InputHandlerTests.cs @@ -18,6 +18,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace JsonRpc.Tests { [Collection("InputHandlers")] @@ -35,7 +37,7 @@ private InputHandler NewHandler( PipeReader inputStream, IOutputHandler outputHandler, IReceiver receiver, - IRequestRouter requestRouter, + IRequestRouter requestRouter, ILoggerFactory loggerFactory, IResponseRouter responseRouter, RequestInvoker requestInvoker @@ -64,7 +66,7 @@ public async Task Should_Pass_In_Requests() using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -90,7 +92,7 @@ public async Task Should_Handle_Multiple_Requests_At_Once() using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -132,7 +134,7 @@ public async Task Should_Handle_Different_Additional_Headers_and_Whitespace(stri using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -160,7 +162,7 @@ public async Task Should_Handle_Multiple_Requests_Back_To_Back() using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -193,7 +195,7 @@ public async Task Should_Handle_Multiple_Requests_In_Pieces() using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -236,7 +238,7 @@ public async Task Should_Handle_Multiple_Chunked_Requests(string content) using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -271,7 +273,7 @@ public async Task Should_Handle_Header_Terminiator_Being_Incomplete() using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -324,7 +326,7 @@ public async Task ShouldPassAdditionalUtf8EncodedRequests(string data) using var handler = NewHandler( pipe.Reader, outputHandler, receiver, - Substitute.For>(), + Substitute.For>(), _loggerFactory, Substitute.For(), Substitute.For() ); @@ -361,7 +363,7 @@ public async Task Should_Parse_Logs(string name, Func createPipeRead var reader = createPipeReader(); var receiver = new Receiver(); - var incomingRequestRouter = Substitute.For>(); + var incomingRequestRouter = Substitute.For>(); var outputHandler = Substitute.For(); var responseRouter = Substitute.For(); var requestInvoker = Substitute.For(); diff --git a/test/JsonRpc.Tests/ResponseRouterTests.cs b/test/JsonRpc.Tests/ResponseRouterTests.cs index 1612cdf66..7ab340607 100644 --- a/test/JsonRpc.Tests/ResponseRouterTests.cs +++ b/test/JsonRpc.Tests/ResponseRouterTests.cs @@ -11,6 +11,8 @@ using OmniSharp.Extensions.JsonRpc.Serialization; using Xunit; +#nullable disable + namespace JsonRpc.Tests { public class ResponseRouterTests @@ -61,7 +63,7 @@ public async Task WorksWithUnitType() } [Fact] - public async Task WorksWithNotification() + public void WorksWithNotification() { var outputHandler = Substitute.For(); var router = new ResponseRouter(new Lazy(() => outputHandler), new JsonRpcSerializer(), new AssemblyScanningHandlerTypeDescriptorProvider(new [] { typeof(AssemblyScanningHandlerTypeDescriptorProvider).Assembly, typeof(HandlerResolverTests).Assembly })); diff --git a/test/Lsp.Integration.Tests/DisableDefaultsTests.cs b/test/Lsp.Integration.Tests/DisableDefaultsTests.cs index 12dae2e72..04df53404 100644 --- a/test/Lsp.Integration.Tests/DisableDefaultsTests.cs +++ b/test/Lsp.Integration.Tests/DisableDefaultsTests.cs @@ -92,7 +92,7 @@ await TestHelper.DelayUntil( action.Received(1).Invoke(Arg.Any()); return true; } - catch (ReceivedCallsException e) + catch (ReceivedCallsException) { return false; } @@ -144,7 +144,7 @@ await TestHelper.DelayUntil( action.Received(1).Invoke(Arg.Is(z => Equals(z.Settings, JValue.CreateNull()))); return true; } - catch (ReceivedCallsException e) + catch (ReceivedCallsException) { return false; } diff --git a/test/Lsp.Integration.Tests/ErroringHandlingTests.cs b/test/Lsp.Integration.Tests/ErroringHandlingTests.cs index ef8b12034..b7250d56b 100644 --- a/test/Lsp.Integration.Tests/ErroringHandlingTests.cs +++ b/test/Lsp.Integration.Tests/ErroringHandlingTests.cs @@ -13,6 +13,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class ErroringHandlingTests : LanguageProtocolTestBase diff --git a/test/Lsp.Integration.Tests/ExecuteTypedCommandTests.cs b/test/Lsp.Integration.Tests/ExecuteTypedCommandTests.cs index 732a46dde..7f366a276 100644 --- a/test/Lsp.Integration.Tests/ExecuteTypedCommandTests.cs +++ b/test/Lsp.Integration.Tests/ExecuteTypedCommandTests.cs @@ -18,6 +18,7 @@ using Xunit; using Xunit.Abstractions; +#nullable disable namespace Lsp.Integration.Tests { diff --git a/test/Lsp.Integration.Tests/ExtensionTests.cs b/test/Lsp.Integration.Tests/ExtensionTests.cs index fe607fba5..a76c80965 100644 --- a/test/Lsp.Integration.Tests/ExtensionTests.cs +++ b/test/Lsp.Integration.Tests/ExtensionTests.cs @@ -20,6 +20,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class ExtensionTests : LanguageProtocolTestBase diff --git a/test/Lsp.Integration.Tests/FileOperationsTests.cs b/test/Lsp.Integration.Tests/FileOperationsTests.cs index b86c2ba0a..deff69111 100644 --- a/test/Lsp.Integration.Tests/FileOperationsTests.cs +++ b/test/Lsp.Integration.Tests/FileOperationsTests.cs @@ -15,24 +15,26 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class FileOperationsTests : LanguageProtocolTestBase { private readonly Action _didCreateFileHandler = Substitute.For>(); - private readonly Func> _willCreateFileHandler = - Substitute.For>>(); + private readonly Func> _willCreateFileHandler = + Substitute.For>>(); private readonly Action _didRenameFileHandler = Substitute.For>(); - private readonly Func> _willRenameFileHandler = - Substitute.For>>(); + private readonly Func> _willRenameFileHandler = + Substitute.For>>(); private readonly Action _didDeleteFileHandler = Substitute.For>(); - private readonly Func> _willDeleteFileHandler = - Substitute.For>>(); + private readonly Func> _willDeleteFileHandler = + Substitute.For>>(); public FileOperationsTests(ITestOutputHelper outputHelper) : base(new JsonRpcTestOptions().ConfigureForXUnit(outputHelper, LogEventLevel.Verbose)) { diff --git a/test/Lsp.Integration.Tests/Fixtures/DefaultClient.cs b/test/Lsp.Integration.Tests/Fixtures/DefaultClient.cs index bea286c1b..cfed50d6b 100644 --- a/test/Lsp.Integration.Tests/Fixtures/DefaultClient.cs +++ b/test/Lsp.Integration.Tests/Fixtures/DefaultClient.cs @@ -2,6 +2,8 @@ using OmniSharp.Extensions.LanguageServer.Client; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +#nullable disable + namespace Lsp.Integration.Tests.Fixtures { public sealed class DefaultClient : IConfigureLanguageClientOptions diff --git a/test/Lsp.Integration.Tests/InitializationTests.cs b/test/Lsp.Integration.Tests/InitializationTests.cs index 3afead878..f4fda090c 100644 --- a/test/Lsp.Integration.Tests/InitializationTests.cs +++ b/test/Lsp.Integration.Tests/InitializationTests.cs @@ -21,6 +21,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class InitializationTests : LanguageProtocolTestBase diff --git a/test/Lsp.Integration.Tests/LanguageServerConfigurationTests.cs b/test/Lsp.Integration.Tests/LanguageServerConfigurationTests.cs index 134c4fc87..c28a589f0 100644 --- a/test/Lsp.Integration.Tests/LanguageServerConfigurationTests.cs +++ b/test/Lsp.Integration.Tests/LanguageServerConfigurationTests.cs @@ -23,6 +23,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class LanguageServerConfigurationTests : LanguageProtocolTestBase @@ -54,7 +56,7 @@ public async Task Should_Allow_Null_Response() options => { options.WithCapability(new DidChangeConfigurationCapability()); - options.OnConfiguration(@params => Task.FromResult(new Container(@params.Items.Select(z => (JToken?)null)))); + options.OnConfiguration(@params => Task.FromResult(new Container(@params.Items.Select(z => (JToken)null)))); ConfigureClient(options); }, ConfigureServer ); diff --git a/test/Lsp.Integration.Tests/OverrideHandlerTests.cs b/test/Lsp.Integration.Tests/OverrideHandlerTests.cs index 435f2cf3b..5fc964eaf 100644 --- a/test/Lsp.Integration.Tests/OverrideHandlerTests.cs +++ b/test/Lsp.Integration.Tests/OverrideHandlerTests.cs @@ -15,6 +15,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class OverrideHandlerTests : LanguageProtocolTestBase @@ -76,7 +78,7 @@ public class CustomExecuteCommandHandler : IJsonRpcRequestHandler { // ReSharper disable once NotAccessedField.Local - private ExecuteCommandCapability? _capability; + private ExecuteCommandCapability _capability; private readonly ExecuteCommandRegistrationOptions _executeCommandRegistrationOptions = new ExecuteCommandRegistrationOptions { @@ -108,6 +110,6 @@ public ExecuteCommandRegistrationOptions GetRegistrationOptions(ExecuteCommandCa /// Arguments that the command should be invoked with. /// [Optional] - public JArray? Arguments { get; init; } + public JArray Arguments { get; init; } } } diff --git a/test/Lsp.Integration.Tests/PartialItemsTests.cs b/test/Lsp.Integration.Tests/PartialItemsTests.cs index 823ab721d..358f3e9f0 100644 --- a/test/Lsp.Integration.Tests/PartialItemsTests.cs +++ b/test/Lsp.Integration.Tests/PartialItemsTests.cs @@ -20,6 +20,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public static class PartialItemsTests diff --git a/test/Lsp.Integration.Tests/ProgressTests.cs b/test/Lsp.Integration.Tests/ProgressTests.cs index 6c7dad46a..2eba8c2ae 100644 --- a/test/Lsp.Integration.Tests/ProgressTests.cs +++ b/test/Lsp.Integration.Tests/ProgressTests.cs @@ -15,6 +15,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class ProgressTests : LanguageProtocolFixtureTest @@ -37,7 +39,9 @@ public async Task Should_Send_Progress_From_Server_To_Client() using var observer = Client.ProgressManager.For(token, CancellationToken); var workDoneObservable = Server.ProgressManager.Monitor( + #pragma warning disable CS0618 token, x => x.ToObject(Server.Services.GetRequiredService().JsonSerializer) + #pragma warning restore CS0618 ); var observable = workDoneObservable.Replay(); using var _ = observable.Connect(); @@ -95,7 +99,9 @@ public async Task Should_Send_Progress_From_Client_To_Server() using var observer = Server.ProgressManager.For(token, CancellationToken); var workDoneObservable = Client.ProgressManager.Monitor( + #pragma warning disable CS0618 token, x => x.ToObject(Client.Services.GetRequiredService().JsonSerializer) + #pragma warning restore CS0618 ); var observable = workDoneObservable.Replay(); using var _ = observable.Connect(); diff --git a/test/Lsp.Integration.Tests/ProposalTests.cs b/test/Lsp.Integration.Tests/ProposalTests.cs index d03efd0ae..6e569cd39 100644 --- a/test/Lsp.Integration.Tests/ProposalTests.cs +++ b/test/Lsp.Integration.Tests/ProposalTests.cs @@ -9,6 +9,8 @@ using Xunit; using Xunit.Abstractions; +#pragma warning disable CS0618 // Obsolete + namespace Lsp.Integration.Tests { public class ProposalTests : LanguageProtocolTestBase diff --git a/test/Lsp.Integration.Tests/TypedCallHierarchyTests.cs b/test/Lsp.Integration.Tests/TypedCallHierarchyTests.cs index 1209b0bf9..e5be3eeb4 100644 --- a/test/Lsp.Integration.Tests/TypedCallHierarchyTests.cs +++ b/test/Lsp.Integration.Tests/TypedCallHierarchyTests.cs @@ -16,6 +16,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class TypedCallHierarchyTests : LanguageProtocolTestBase @@ -27,10 +29,10 @@ public TypedCallHierarchyTests(ITestOutputHelper outputHelper) : base(new JsonRp [Fact] public async Task Should_Aggregate_With_All_Related_Handlers() { - var incomingHandlerA = Substitute.For, Task?>>>(); - var incomingHandlerB = Substitute.For, Task?>>>(); - var outgoingHandlerA = Substitute.For, Task?>>>(); - var outgoingHandlerB = Substitute.For, Task?>>>(); + var incomingHandlerA = Substitute.For, Task>>>(); + var incomingHandlerB = Substitute.For, Task>>>(); + var outgoingHandlerA = Substitute.For, Task>>>(); + var outgoingHandlerB = Substitute.For, Task>>>(); var (client, _) = await Initialize( options => { options.EnableAllCapabilities(); }, options => { @@ -42,7 +44,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnCallHierarchy( @params => Task.FromResult( - new Container?>( + new Container>( new CallHierarchyItem { Name = "Test", @@ -69,7 +71,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnCallHierarchy( @params => Task.FromResult( - new Container?>( + new Container>( new CallHierarchyItem { Name = "Test Nested", @@ -116,14 +118,14 @@ public async Task Should_Aggregate_With_All_Related_Handlers() [Fact] public async Task Should_Resolve_With_Data_Capability() { - var incomingHandler = Substitute.For, Task?>>>(); - var outgoingHandler = Substitute.For, Task?>>>(); + var incomingHandler = Substitute.For, Task>>>(); + var outgoingHandler = Substitute.For, Task>>>(); var (client, _) = await Initialize( options => { options.EnableAllCapabilities(); }, options => { options.OnCallHierarchy( @params => Task.FromResult( - new Container?>( + new Container>( new CallHierarchyItem { Name = "Test", @@ -176,8 +178,8 @@ public async Task Should_Resolve_With_Partial_Data_Capability() options.OnCallHierarchy( (completionParams, observer) => { - var a = new Container?>( - new Container?>( + var a = new Container>( + new Container>( new CallHierarchyItem { Name = "Test", diff --git a/test/Lsp.Integration.Tests/TypedCodeActionTests.cs b/test/Lsp.Integration.Tests/TypedCodeActionTests.cs index d626e33eb..6d3e2fa8c 100644 --- a/test/Lsp.Integration.Tests/TypedCodeActionTests.cs +++ b/test/Lsp.Integration.Tests/TypedCodeActionTests.cs @@ -16,6 +16,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class TypedCodeActionTests : LanguageProtocolTestBase diff --git a/test/Lsp.Integration.Tests/TypedCodeLensTests.cs b/test/Lsp.Integration.Tests/TypedCodeLensTests.cs index 48cc3689c..c473c3fb7 100644 --- a/test/Lsp.Integration.Tests/TypedCodeLensTests.cs +++ b/test/Lsp.Integration.Tests/TypedCodeLensTests.cs @@ -16,6 +16,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class TypedCodeLensTests : LanguageProtocolTestBase @@ -39,7 +41,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnCodeLens( codeLensParams => { - return Task.FromResult( + return Task.FromResult( new CodeLensContainer( new CodeLens { @@ -71,7 +73,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnCodeLens( codeLensParams => { - return Task.FromResult( + return Task.FromResult( new CodeLensContainer( new CodeLens { @@ -98,7 +100,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnCodeLens( codeLensParams => { - return Task.FromResult( + return Task.FromResult( new CodeLensContainer( new CodeLens { @@ -121,7 +123,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnCodeLens( codeLensParams => { - return Task.FromResult( + return Task.FromResult( new CodeLensContainer( new CodeLens { @@ -167,7 +169,7 @@ public async Task Should_Resolve_With_Data_Capability() options.OnCodeLens( (codeLensParams, capability, token) => { - return Task.FromResult?>( + return Task.FromResult>( new CodeLensContainer( new CodeLens { @@ -195,7 +197,6 @@ public async Task Should_Resolve_With_Data_Capability() lens.Data.Child.Should().NotBeNull(); lens.Data.Name.Should().Be("name"); return Task.FromResult(lens with { Command = lens.Command with { Name = "resolved" } }); - return Task.FromResult(lens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -248,7 +249,6 @@ public async Task Should_Resolve_With_Partial_Data_Capability() codeLens.Data.Child.Should().NotBeNull(); codeLens.Data.Name.Should().Be("name"); return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -270,7 +270,7 @@ public async Task Should_Resolve_With_Data_CancellationToken() options.OnCodeLens( (codeLensParams, token) => { - return Task.FromResult?>( + return Task.FromResult>( new CodeLensContainer( new CodeLens { @@ -298,7 +298,6 @@ public async Task Should_Resolve_With_Data_CancellationToken() codeLens.Data.Child.Should().NotBeNull(); codeLens.Data.Name.Should().Be("name"); return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -351,7 +350,6 @@ public async Task Should_Resolve_With_Partial_Data_CancellationToken() codeLens.Data.Child.Should().NotBeNull(); codeLens.Data.Name.Should().Be("name"); return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -401,7 +399,6 @@ public async Task Should_Resolve_With_Data() codeLens.Data.Child.Should().NotBeNull(); codeLens.Data.Name.Should().Be("name"); return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -454,7 +451,6 @@ public async Task Should_Resolve_With_Partial_Data() codeLens.Data.Child.Should().NotBeNull(); codeLens.Data.Name.Should().Be("name"); return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -493,7 +489,6 @@ public async Task Should_Resolve_Capability() (codeLens, capability, token) => { return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -534,7 +529,6 @@ public async Task Should_Resolve_Partial_Capability() (codeLens, capability, token) => { return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -572,7 +566,6 @@ public async Task Should_Resolve_CancellationToken() (codeLens, token) => { return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -613,7 +606,6 @@ public async Task Should_Resolve_Partial_CancellationToken() (codeLens, token) => { return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -651,7 +643,6 @@ public async Task Should_Resolve() codeLens => { return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); @@ -692,7 +683,6 @@ public async Task Should_Resolve_Partial() codeLens => { return Task.FromResult(codeLens with { Command = codeLens.Command with { Name = "resolved" } }); - return Task.FromResult(codeLens); }, (_, _) => new CodeLensRegistrationOptions() ); diff --git a/test/Lsp.Integration.Tests/TypedCompletionTests.cs b/test/Lsp.Integration.Tests/TypedCompletionTests.cs index 95120baeb..9a0e9f4a0 100644 --- a/test/Lsp.Integration.Tests/TypedCompletionTests.cs +++ b/test/Lsp.Integration.Tests/TypedCompletionTests.cs @@ -16,6 +16,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class TypedCompletionTests : LanguageProtocolTestBase @@ -195,12 +197,6 @@ public async Task Should_Resolve_With_Data_Capability() completionItem.Data!.Child.Should().NotBeNull(); completionItem.Data!.Name.Should().Be("name"); return Task.FromResult(completionItem with { Detail = "resolved" }); - return Task.FromResult( - completionItem with - { - Detail = "resolved" - } - ); }, (_, _) => new CompletionRegistrationOptions() ); diff --git a/test/Lsp.Integration.Tests/TypedDocumentLinkTests.cs b/test/Lsp.Integration.Tests/TypedDocumentLinkTests.cs index f3e8a238b..7734c0f78 100644 --- a/test/Lsp.Integration.Tests/TypedDocumentLinkTests.cs +++ b/test/Lsp.Integration.Tests/TypedDocumentLinkTests.cs @@ -15,6 +15,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public partial class TypedDocumentLinkTests : LanguageProtocolTestBase @@ -66,7 +68,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnDocumentLink( codeLensParams => { - return Task.FromResult?>( + return Task.FromResult>( new DocumentLinkContainer( new DocumentLink { diff --git a/test/Lsp.Integration.Tests/TypedInlayHintTests.cs b/test/Lsp.Integration.Tests/TypedInlayHintTests.cs index e104c8fe0..6bc11a9f5 100644 --- a/test/Lsp.Integration.Tests/TypedInlayHintTests.cs +++ b/test/Lsp.Integration.Tests/TypedInlayHintTests.cs @@ -16,6 +16,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class TypedInlayHintTests : LanguageProtocolTestBase @@ -39,7 +41,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnInlayHints( inlayHintParams => { - return Task.FromResult?>( + return Task.FromResult>( new InlayHintContainer( new InlayHint { @@ -82,7 +84,7 @@ l with options.OnInlayHints( inlayHintParams => { - return Task.FromResult( + return Task.FromResult( new InlayHintContainer( new InlayHint { @@ -124,7 +126,7 @@ l with options.OnInlayHints( inlayHintParams => { - return Task.FromResult( + return Task.FromResult( new InlayHintContainer( new InlayHint { @@ -163,7 +165,7 @@ l with options.OnInlayHints( inlayHintParams => { - return Task.FromResult( + return Task.FromResult( new InlayHintContainer( new InlayHint { @@ -216,7 +218,7 @@ public async Task Should_Resolve_With_Data_Capability() options.OnInlayHints( (InlayHintParams, capability, token) => { - return Task.FromResult?>( + return Task.FromResult>( new InlayHintContainer( new InlayHint { diff --git a/test/Lsp.Integration.Tests/TypedTypeHierarchyTests.cs b/test/Lsp.Integration.Tests/TypedTypeHierarchyTests.cs index ffaa80f78..79f9d5d21 100644 --- a/test/Lsp.Integration.Tests/TypedTypeHierarchyTests.cs +++ b/test/Lsp.Integration.Tests/TypedTypeHierarchyTests.cs @@ -16,6 +16,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class TypedTypeHierarchyTests : LanguageProtocolTestBase @@ -27,10 +29,10 @@ public TypedTypeHierarchyTests(ITestOutputHelper outputHelper) : base(new JsonRp [Fact] public async Task Should_Aggregate_With_All_Related_Handlers() { - var subtypeHandlerA = Substitute.For, Task?>>>(); - var subtypeHandlerB = Substitute.For, Task?>>>(); - var supertypeHandlerA = Substitute.For, Task?>>>(); - var supertypeHandlerB = Substitute.For, Task?>>>(); + var subtypeHandlerA = Substitute.For, Task>>>(); + var subtypeHandlerB = Substitute.For, Task>>>(); + var supertypeHandlerA = Substitute.For, Task>>>(); + var supertypeHandlerB = Substitute.For, Task>>>(); var (client, _) = await Initialize( options => { options.EnableAllCapabilities(); }, options => { @@ -42,7 +44,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnTypeHierarchy( @params => Task.FromResult( - new Container?>( + new Container>( new TypeHierarchyItem { Name = "Test", @@ -69,7 +71,7 @@ public async Task Should_Aggregate_With_All_Related_Handlers() options.OnTypeHierarchy( @params => Task.FromResult( - new Container?>( + new Container>( new TypeHierarchyItem { Name = "Test Nested", @@ -116,14 +118,14 @@ public async Task Should_Aggregate_With_All_Related_Handlers() [Fact] public async Task Should_Resolve_With_Data_Capability() { - var subtypeHandler = Substitute.For, Task?>>>(); - var supertypeHandler = Substitute.For, Task?>>>(); + var subtypeHandler = Substitute.For, Task>>>(); + var supertypeHandler = Substitute.For, Task>>>(); var (client, _) = await Initialize( options => { options.EnableAllCapabilities(); }, options => { options.OnTypeHierarchy( @params => Task.FromResult( - new Container?>( + new Container>( new TypeHierarchyItem { Name = "Test", @@ -176,8 +178,8 @@ public async Task Should_Resolve_With_Partial_Data_Capability() options.OnTypeHierarchy( (completionParams, observer) => { - var a = new Container?>( - new Container?>( + var a = new Container>( + new Container>( new TypeHierarchyItem { Name = "Test", diff --git a/test/Lsp.Integration.Tests/WorkspaceFolderTests.cs b/test/Lsp.Integration.Tests/WorkspaceFolderTests.cs index 0a38d9877..74d39cc6b 100644 --- a/test/Lsp.Integration.Tests/WorkspaceFolderTests.cs +++ b/test/Lsp.Integration.Tests/WorkspaceFolderTests.cs @@ -20,6 +20,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Integration.Tests { public class WorkspaceFolderTests : LanguageProtocolTestBase @@ -78,7 +80,7 @@ public async Task Should_Allow_Null_Response() options => { ConfigureClient(options); - options.OnWorkspaceFolders(@params => Task.FromResult?>(null)); + options.OnWorkspaceFolders(@params => Task.FromResult>(null)); }, ConfigureServer ); @@ -185,7 +187,7 @@ public async Task Should_Handle_Null_Workspace_Folders_On_Refresh() WorkspaceFolders = null } ); - languageServer.SendRequest(Arg.Any(), Arg.Any()).Returns((Container?)null); + languageServer.SendRequest(Arg.Any(), Arg.Any()).Returns((Container)null); var workspaceFolders = new LanguageServerWorkspaceFolderManager(workspaceLanguageServer); ( (IRegistration)workspaceFolders ).GetRegistrationOptions( languageServer!.ClientSettings!.Capabilities! diff --git a/test/Lsp.Tests/AbsoluteUriConverterTests.cs b/test/Lsp.Tests/AbsoluteUriConverterTests.cs index f0457d3f7..2f93bd8c4 100644 --- a/test/Lsp.Tests/AbsoluteUriConverterTests.cs +++ b/test/Lsp.Tests/AbsoluteUriConverterTests.cs @@ -5,6 +5,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Tests { public class AbsoluteUriConverterTests diff --git a/test/Lsp.Tests/FoundationTests.cs b/test/Lsp.Tests/FoundationTests.cs index 74d40e816..f6fe3331d 100644 --- a/test/Lsp.Tests/FoundationTests.cs +++ b/test/Lsp.Tests/FoundationTests.cs @@ -27,6 +27,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Tests { public class FoundationTests @@ -565,11 +567,11 @@ private class MethodMatcher private readonly IEnumerable _registries; private readonly ILspHandlerTypeDescriptor _descriptor; private readonly Type _extensionClass; - private readonly string? _methodName; + private readonly string _methodName; public MethodMatcher( IEnumerable registries, - ILspHandlerTypeDescriptor descriptor, Type extensionClass, string? methodName = null + ILspHandlerTypeDescriptor descriptor, Type extensionClass, string methodName = null ) { _registries = registries; diff --git a/test/Lsp.Tests/LspRequestRouterTests.cs b/test/Lsp.Tests/LspRequestRouterTests.cs index a017aeaa6..693c55bb5 100644 --- a/test/Lsp.Tests/LspRequestRouterTests.cs +++ b/test/Lsp.Tests/LspRequestRouterTests.cs @@ -27,6 +27,8 @@ using Arg = NSubstitute.Arg; using Request = OmniSharp.Extensions.JsonRpc.Server.Request; +#nullable disable + namespace Lsp.Tests { public class TestLanguageServerRegistry : JsonRpcOptionsRegistryBase, ILanguageServerRegistry diff --git a/test/Lsp.Tests/Matchers/ResolveCommandMatcherTests.cs b/test/Lsp.Tests/Matchers/ResolveCommandMatcherTests.cs index b2b86c212..f88fd7a03 100644 --- a/test/Lsp.Tests/Matchers/ResolveCommandMatcherTests.cs +++ b/test/Lsp.Tests/Matchers/ResolveCommandMatcherTests.cs @@ -18,6 +18,8 @@ using Xunit; using Xunit.Abstractions; +#nullable disable + namespace Lsp.Tests.Matchers { public class ResolveCommandMatcherTests : AutoTestBase diff --git a/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs b/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs index a49a11af9..01a2b0a92 100644 --- a/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs +++ b/test/Lsp.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs @@ -25,6 +25,8 @@ using Request = OmniSharp.Extensions.JsonRpc.Server.Request; #pragma warning disable CS0162 +#nullable disable + namespace Lsp.Tests { public class MediatorTestsRequestHandlerOfTRequestTResponse : AutoTestBase diff --git a/test/Lsp.Tests/SupportedCapabilitiesFixture.cs b/test/Lsp.Tests/SupportedCapabilitiesFixture.cs index 1df0e5a83..1e2b63673 100644 --- a/test/Lsp.Tests/SupportedCapabilitiesFixture.cs +++ b/test/Lsp.Tests/SupportedCapabilitiesFixture.cs @@ -3,6 +3,8 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Shared; using OmniSharp.Extensions.LanguageServer.Shared; +#nullable disable + namespace Lsp.Tests { public class SupportedCapabilitiesFixture @@ -24,7 +26,7 @@ public bool AllowsDynamicRegistration(Type capabilityType) return true; } - protected override bool TryGetCapability(Type capabilityType, [NotNullWhen(true)] out object? capability) + protected override bool TryGetCapability(Type capabilityType, [NotNullWhen(true)] out object capability) { capability = Activator.CreateInstance(capabilityType); return true; @@ -45,7 +47,7 @@ public bool AllowsDynamicRegistration(Type capabilityType) return false; } - protected override bool TryGetCapability(Type capabilityType, [NotNullWhen(true)] out object? capability) + protected override bool TryGetCapability(Type capabilityType, [NotNullWhen(true)] out object capability) { capability = null; return false; diff --git a/test/Lsp.Tests/TextDocumentSyncHandlerExtensions.cs b/test/Lsp.Tests/TextDocumentSyncHandlerExtensions.cs index e899ca4a1..a1c7061d1 100644 --- a/test/Lsp.Tests/TextDocumentSyncHandlerExtensions.cs +++ b/test/Lsp.Tests/TextDocumentSyncHandlerExtensions.cs @@ -4,14 +4,16 @@ using OmniSharp.Extensions.LanguageServer.Protocol.Document; using OmniSharp.Extensions.LanguageServer.Protocol.Models; +#nullable disable + namespace Lsp.Tests { internal static class TextDocumentSyncHandlerExtensions { - public static ITextDocumentSyncHandler With(TextDocumentSelector? documentSelector, string language) => + public static ITextDocumentSyncHandler With(TextDocumentSelector documentSelector, string language) => Substitute.For().With(documentSelector, language); - public static ITextDocumentSyncHandler With(this ITextDocumentSyncHandler handler, TextDocumentSelector? documentSelector, string language) + public static ITextDocumentSyncHandler With(this ITextDocumentSyncHandler handler, TextDocumentSelector documentSelector, string language) { ( (IDidChangeTextDocumentHandler) handler ).GetRegistrationOptions(Arg.Any(), Arg.Any()).Returns(new TextDocumentChangeRegistrationOptions() { DocumentSelector = documentSelector }); ( (IDidOpenTextDocumentHandler) handler ).GetRegistrationOptions(Arg.Any(), Arg.Any()).Returns(new TextDocumentOpenRegistrationOptions() { DocumentSelector = documentSelector }); diff --git a/test/TestingUtils/AutoNSubstitute/AutoSubstitute.cs b/test/TestingUtils/AutoNSubstitute/AutoSubstitute.cs index 9fe76b9d1..ac599ac34 100644 --- a/test/TestingUtils/AutoNSubstitute/AutoSubstitute.cs +++ b/test/TestingUtils/AutoNSubstitute/AutoSubstitute.cs @@ -47,7 +47,7 @@ internal AutoSubstitute( /// /// The type of the service. /// The service. - public T Resolve() => Container.GetRequiredService(); + public T Resolve() where T : notnull => Container.GetRequiredService(); /// /// Resolve the specified type in the container (register specified instance if needed). diff --git a/test/TestingUtils/AutoNSubstitute/TestLogger.cs b/test/TestingUtils/AutoNSubstitute/TestLogger.cs index cb777ed61..7be117d76 100644 --- a/test/TestingUtils/AutoNSubstitute/TestLogger.cs +++ b/test/TestingUtils/AutoNSubstitute/TestLogger.cs @@ -4,6 +4,8 @@ using System.Reactive.Disposables; using Microsoft.Extensions.Logging; +#nullable disable + // ReSharper disable once CheckNamespace namespace NSubstitute { @@ -16,7 +18,7 @@ public TestLogger(IEnumerable loggers) _loggers = loggers; } - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) { foreach (var logger in _loggers) { diff --git a/test/TestingUtils/AutoNSubstitute/TraceWriter.cs b/test/TestingUtils/AutoNSubstitute/TraceWriter.cs index 8eb873e54..7076103ca 100644 --- a/test/TestingUtils/AutoNSubstitute/TraceWriter.cs +++ b/test/TestingUtils/AutoNSubstitute/TraceWriter.cs @@ -1,6 +1,8 @@ using System; using Microsoft.Extensions.Logging; +#nullable disable + // ReSharper disable once CheckNamespace namespace NSubstitute { diff --git a/test/TestingUtils/BlockingMessageBus.cs b/test/TestingUtils/BlockingMessageBus.cs index c82955dfb..ae73dc698 100644 --- a/test/TestingUtils/BlockingMessageBus.cs +++ b/test/TestingUtils/BlockingMessageBus.cs @@ -4,6 +4,8 @@ using Xunit.Abstractions; using Xunit.Sdk; +#nullable disable + namespace TestingUtils { /// diff --git a/test/coverlet.runsettings b/test/coverlet.runsettings index 46a49a78a..36f6487de 100644 --- a/test/coverlet.runsettings +++ b/test/coverlet.runsettings @@ -1,14 +1,116 @@ +ο»Ώ - - - - - json,lcov,cobertura,opencover - [Bogus*]*,[Autofac*]*,[FakeItEasy*]*,[Moq*]*,[xunit*]*,[Microsoft.*]*,[XunitXml*]*,[coverlet.*]*,[System.*]*,[*]JetBrains.Annotations* - [OmniSharp.*]* - Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute - - - - - + + + + + Cobertura + [Bogus*]*,[Autofac*]*,[FakeItEasy*]*,[Moq*]*,[xunit*]*,[Microsoft.*]*,[XunitXml*]*,[coverlet.*]*,[System.*]*,[*]JetBrains.Annotations* + [OmniSharp.*]* + Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute + + + + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + ^System\.Diagnostics\.DebuggerHiddenAttribute$ + ^System\.Diagnostics\.DebuggerNonUserCodeAttribute$ + ^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$ + + + + + ^Bogus.* + ^DryIoc.* + ^FakeItEasy.* + ^FluentAssertions.* + ^JetBrains\..* + ^Microsoft\..* + ^Moq.* + ^NSubstitute.* + ^Nuke.* + ^Serilog.* + ^System\..* + ^TUnit.* + ^Verify.* + ^XUnit.* + + + + + .*\.build\.dll + .*Client\.dll + .*Client\.Tests\.dll + .*Dap\.Client\.dll + .*Dap\.Protocol\.dll + .*Dap\.Protocol\.Proposals\.dll + .*Dap\.Server\.dll + .*Dap\.Shared\.dll + .*Dap\.Testing\.dll + .*Dap\.Tests\.dll + .*Generation\.Tests\.dll + .*JsonRpc\.dll + .*JsonRpc\.Generators\.dll + .*JsonRpc\.Testing\.dll + .*JsonRpc\.Tests\.dll + .*Lsp\.Integration\.Tests\.dll + .*Lsp\.Tests\.dll + .*Protocol\.dll + .*Protocol\.Proposals\.dll + .*SampleServer\.dll + .*Server\.dll + .*Shared\.dll + .*Testing\.dll + .*TestingUtils\.dll + + + .*Bogus\.dll + .*coverlet\.collector\.dll + .*coverlet\.msbuild\.dll + .*DryIoc\.Internal\.dll + .*FluentAssertions\.dll + .*GitVersion\.Tool\.dll + .*MediatR\.dll + .*Microsoft\.CodeAnalysis\.Analyzers\.dll + .*Microsoft\.CodeAnalysis\.CSharp\.Workspaces\.dll + .*Microsoft\.Extensions\.Configuration\.Binder\.dll + .*Microsoft\.Extensions\.Configuration\.dll + .*Microsoft\.Extensions\.DependencyInjection\.dll + .*Microsoft\.Extensions\.Logging\.Debug\.dll + .*Microsoft\.Extensions\.Logging\.dll + .*Microsoft\.Extensions\.Options\.ConfigurationExtensions\.dll + .*Microsoft\.Extensions\.Options\.dll + .*Microsoft\.NET\.Test\.Sdk\.dll + .*Microsoft\.NETFramework\.ReferenceAssemblies\.dll + .*Microsoft\.Reactive\.Testing\.dll + .*Microsoft\.SourceLink\.GitHub\.dll + .*Nerdbank\.Streams\.dll + .*NETStandard\.Library\.dll + .*Newtonsoft\.Json\.dll + .*NSubstitute\.dll + .*ReportGenerator\.dll + .*Rocket\.Surgery\.MSBuild\.CI\.dll + .*Rocket\.Surgery\.MSBuild\.SourceLink\.dll + .*Rocket\.Surgery\.Nuke\.dll + .*Serilog\.Extensions\.Logging\.dll + .*Serilog\.Sinks\.Debug\.dll + .*Serilog\.Sinks\.File\.dll + .*Serilog\.Sinks\.Observable\.dll + .*Serilog\.Sinks\.XUnit\.dll + .*Snapper\.dll + .*System\.Collections\.Immutable\.dll + .*System\.Reactive\.dll + .*System\.Threading\.Channels\.dll + .*Verify\.SourceGenerators\.dll + .*Verify\.Xunit\.dll + .*xunit\.dll + .*xunit\.runner\.visualstudio\.dll + .*Xunit\.SkippableFact\.dll + + + + + + + + \ No newline at end of file