diff --git a/.appveyor.yml b/.appveyor.yml
index 8c54926..ea35c16 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -4,14 +4,24 @@
image: Visual Studio 2022
#---------------------------------#
-# Build Script #
+# Install .NET #
#---------------------------------#
install:
- # Update to latest NuGet version since we require 5.3.0 for embedded icon
- - ps: nuget update -self
+ - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
+ - ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
+ - ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1"
+ - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 5.0.408 -InstallDir $env:DOTNET_INSTALL_DIR'
+ - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 6.0.405 -InstallDir $env:DOTNET_INSTALL_DIR'
+ - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Version 7.0.102 -InstallDir $env:DOTNET_INSTALL_DIR'
+ - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
+ - ps: dotnet --info
+
+#---------------------------------#
+# Build Script #
+#---------------------------------#
build_script:
- - ps: .\build.ps1 -Target CI
+ - ps: .\build.ps1 --target=CI
# Tests
test: off
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 0000000..4903ba5
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "cake.tool": {
+ "version": "1.3.0",
+ "commands": [
+ "dotnet-cake"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index c2b96e3..725f28f 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -14,5 +14,18 @@ jobs:
pool:
vmImage: 'windows-2022'
steps:
+ # .NET 5 required for GitVersion
+ - task: UseDotNet@2
+ inputs:
+ version: '5.x'
+ displayName: 'Install .NET 5'
+ - task: UseDotNet@2
+ inputs:
+ version: '6.x'
+ displayName: 'Install .NET 6'
+ - task: UseDotNet@2
+ inputs:
+ version: '7.x'
+ displayName: 'Install .NET 7'
- powershell: ./build.ps1
displayName: 'Cake Build'
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
index 285bb72..0940a31 100644
--- a/build.ps1
+++ b/build.ps1
@@ -1,261 +1,15 @@
-##########################################################################
-# This is the Cake bootstrapper script for PowerShell.
-# Based on boostrapper from https://github.com/cake-build/resources
-##########################################################################
+$ErrorActionPreference = 'Stop'
-<#
+$SCRIPT_NAME = "recipe.cake"
-.SYNOPSIS
-This is a Powershell script to bootstrap a Cake build.
+Write-Host "Restoring .NET Core tools"
+dotnet tool restore
+if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
-.DESCRIPTION
-This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
-and execute your Cake build script with the parameters you provide.
+Write-Host "Bootstrapping Cake"
+dotnet cake $SCRIPT_NAME --bootstrap
+if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
-.PARAMETER Script
-The build script to execute.
-.PARAMETER Target
-The build script target to run.
-.PARAMETER Configuration
-The build configuration to use.
-.PARAMETER Verbosity
-Specifies the amount of information to be displayed.
-.PARAMETER ShowDescription
-Shows description about tasks.
-.PARAMETER DryRun
-Performs a dry run.
-.PARAMETER SkipToolPackageRestore
-Skips restoring of packages.
-.PARAMETER ScriptArgs
-Remaining arguments are added here.
-
-.LINK
-https://cakebuild.net
-
-#>
-
-[CmdletBinding()]
-Param(
- [string]$Script = "recipe.cake",
- [string]$Target,
- [string]$Configuration,
- [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
- [string]$Verbosity,
- [switch]$ShowDescription,
- [Alias("WhatIf", "Noop")]
- [switch]$DryRun,
- [switch]$SkipToolPackageRestore,
- [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
- [string[]]$ScriptArgs
-)
-
-# Attempt to set highest encryption available for SecurityProtocol.
-# PowerShell will not set this by default (until maybe .NET 4.6.x). This
-# will typically produce a message for PowerShell v2 (just an info
-# message though)
-try {
- # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
- # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
- # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
- # installed (.NET 4.5 is an in-place upgrade).
- # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
- if (-not $IsCoreCLR) {
- [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
- }
- } catch {
- Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
- }
-
-[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
-function MD5HashFile([string] $filePath)
-{
- if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
- {
- return $null
- }
-
- [System.IO.Stream] $file = $null;
- [System.Security.Cryptography.MD5] $md5 = $null;
- try
- {
- $md5 = [System.Security.Cryptography.MD5]::Create()
- $file = [System.IO.File]::OpenRead($filePath)
- return [System.BitConverter]::ToString($md5.ComputeHash($file))
- }
- finally
- {
- if ($file -ne $null)
- {
- $file.Dispose()
- }
- }
-}
-
-function GetProxyEnabledWebClient
-{
- $wc = New-Object System.Net.WebClient
- $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
- $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
- $wc.Proxy = $proxy
- return $wc
-}
-
-Write-Host "Preparing to run build script..."
-
-if(!$PSScriptRoot){
- $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
-}
-
-$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
-$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
-$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
-$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
-$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
-$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
-$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
-$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
-$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
-$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
-
-# Make sure tools folder exists
-if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
- Write-Verbose -Message "Creating tools directory..."
- New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
-}
-
-# Make sure that packages.config exist.
-if (!(Test-Path $PACKAGES_CONFIG)) {
- Write-Verbose -Message "Downloading packages.config..."
- try {
- $wc = GetProxyEnabledWebClient
- $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
- } catch {
- Throw "Could not download packages.config."
- }
-}
-
-# Try find NuGet.exe in path if not exists
-if (!(Test-Path $NUGET_EXE)) {
- Write-Verbose -Message "Trying to find nuget.exe in PATH..."
- $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
- $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
- if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
- Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
- $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
- }
-}
-
-# Try download NuGet.exe if not exists
-if (!(Test-Path $NUGET_EXE)) {
- Write-Verbose -Message "Downloading NuGet.exe..."
- try {
- $wc = GetProxyEnabledWebClient
- $wc.DownloadFile($NUGET_URL, $NUGET_EXE)
- } catch {
- Throw "Could not download NuGet.exe."
- }
-}
-
-# Save nuget.exe path to environment to be available to child processed
-$env:NUGET_EXE = $NUGET_EXE
-$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
- "mono `"$NUGET_EXE`""
-} else {
- "`"$NUGET_EXE`""
-}
-
-# Restore tools from NuGet?
-if(-Not $SkipToolPackageRestore.IsPresent) {
- Push-Location
- Set-Location $TOOLS_DIR
-
- # Check for changes in packages.config and remove installed tools if true.
- [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
- if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
- ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
- Write-Verbose -Message "Missing or changed package.config hash..."
- Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
- Remove-Item -Recurse -Force
- }
-
- Write-Verbose -Message "Restoring tools from NuGet..."
-
- $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
-
- if ($LASTEXITCODE -ne 0) {
- Throw "An error occurred while restoring NuGet tools."
- }
- else
- {
- $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
- }
- Write-Verbose -Message ($NuGetOutput | Out-String)
-
- Pop-Location
-}
-
-# Restore addins from NuGet
-if (Test-Path $ADDINS_PACKAGES_CONFIG) {
- Push-Location
- Set-Location $ADDINS_DIR
-
- Write-Verbose -Message "Restoring addins from NuGet..."
- $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
-
- if ($LASTEXITCODE -ne 0) {
- Throw "An error occurred while restoring NuGet addins."
- }
-
- Write-Verbose -Message ($NuGetOutput | Out-String)
-
- Pop-Location
-}
-
-# Restore modules from NuGet
-if (Test-Path $MODULES_PACKAGES_CONFIG) {
- Push-Location
- Set-Location $MODULES_DIR
-
- Write-Verbose -Message "Restoring modules from NuGet..."
- $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
-
- if ($LASTEXITCODE -ne 0) {
- Throw "An error occurred while restoring NuGet modules."
- }
-
- Write-Verbose -Message ($NuGetOutput | Out-String)
-
- Pop-Location
-}
-
-# Make sure that Cake has been installed.
-if (!(Test-Path $CAKE_EXE)) {
- Throw "Could not find Cake.exe at $CAKE_EXE"
-}
-
-$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
- "mono `"$CAKE_EXE`""
-} else {
- "`"$CAKE_EXE`""
-}
-
- # Build an array (not a string) of Cake arguments to be joined later
-$cakeArguments = @()
-if ($Script) { $cakeArguments += "`"$Script`"" }
-if ($Target) { $cakeArguments += "-target=`"$Target`"" }
-if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
-if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
-if ($ShowDescription) { $cakeArguments += "-showdescription" }
-if ($DryRun) { $cakeArguments += "-dryrun" }
-$cakeArguments += $ScriptArgs
-
-# Bootstrap & start Cake
-Write-Host "Bootstrapping Cake..."
-Invoke-Expression "& $CAKE_EXE_INVOCATION $Script --bootstrap"
-if ($LASTEXITCODE -eq 0)
-{
- Write-Host "Running build script..."
- Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
-}
-
-exit $LASTEXITCODE
\ No newline at end of file
+Write-Host "Running Build"
+dotnet cake $SCRIPT_NAME @args
+if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
\ No newline at end of file
diff --git a/build.sh b/build.sh
index 878a2f2..ba5d0c9 100755
--- a/build.sh
+++ b/build.sh
@@ -1,116 +1,11 @@
-#!/usr/bin/env bash
+#!/bin/bash
+SCRIPT_NAME="recipe.cake"
-##########################################################################
-# This is the Cake bootstrapper script for Linux and OS X.
-# Based on bootstrapper from https://github.com/cake-build/resources
-##########################################################################
+echo "Restoring .NET Core tools"
+dotnet tool restore
-# Define directories.
-SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-TOOLS_DIR=$SCRIPT_DIR/tools
-ADDINS_DIR=$TOOLS_DIR/Addins
-MODULES_DIR=$TOOLS_DIR/Modules
-NUGET_EXE=$TOOLS_DIR/nuget.exe
-CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
-PACKAGES_CONFIG=$TOOLS_DIR/packages.config
-PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
-ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
-MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config
+echo "Bootstrapping Cake"
+dotnet cake $SCRIPT_NAME --bootstrap
-# Define md5sum or md5 depending on Linux/OSX
-MD5_EXE=
-if [[ "$(uname -s)" == "Darwin" ]]; then
- MD5_EXE="md5 -r"
-else
- MD5_EXE="md5sum"
-fi
-
-# Define default arguments.
-SCRIPT="recipe.cake"
-CAKE_ARGUMENTS=()
-
-# Parse arguments.
-for i in "$@"; do
- case $1 in
- -s|--script) SCRIPT="$2"; shift ;;
- --) shift; CAKE_ARGUMENTS+=("$@"); break ;;
- *) CAKE_ARGUMENTS+=("$1") ;;
- esac
- shift
-done
-
-# Make sure the tools folder exist.
-if [ ! -d "$TOOLS_DIR" ]; then
- mkdir "$TOOLS_DIR"
-fi
-
-# Make sure that packages.config exist.
-if [ ! -f "$TOOLS_DIR/packages.config" ]; then
- echo "Downloading packages.config..."
- curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
- if [ $? -ne 0 ]; then
- echo "An error occurred while downloading packages.config."
- exit 1
- fi
-fi
-
-# Download NuGet if it does not exist.
-if [ ! -f "$NUGET_EXE" ]; then
- echo "Downloading NuGet..."
- curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
- if [ $? -ne 0 ]; then
- echo "An error occurred while downloading nuget.exe."
- exit 1
- fi
-fi
-
-# Restore tools from NuGet.
-pushd "$TOOLS_DIR" >/dev/null
-if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
- find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf
-fi
-
-mono "$NUGET_EXE" install -ExcludeVersion
-if [ $? -ne 0 ]; then
- echo "Could not restore NuGet tools."
- exit 1
-fi
-
-$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"
-
-popd >/dev/null
-
-# Restore addins from NuGet.
-if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
- pushd "$ADDINS_DIR" >/dev/null
-
- mono "$NUGET_EXE" install -ExcludeVersion
- if [ $? -ne 0 ]; then
- echo "Could not restore NuGet addins."
- exit 1
- fi
-
- popd >/dev/null
-fi
-
-# Restore modules from NuGet.
-if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
- pushd "$MODULES_DIR" >/dev/null
-
- mono "$NUGET_EXE" install -ExcludeVersion
- if [ $? -ne 0 ]; then
- echo "Could not restore NuGet modules."
- exit 1
- fi
-
- popd >/dev/null
-fi
-
-# Make sure that Cake has been installed.
-if [ ! -f "$CAKE_EXE" ]; then
- echo "Could not find Cake.exe at '$CAKE_EXE'."
- exit 1
-fi
-
-# Bootstrap & start Cake
-(exec mono "$CAKE_EXE" $SCRIPT --bootstrap) && (exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}")
\ No newline at end of file
+echo "Running Build"
+dotnet cake $SCRIPT_NAME "$@"
\ No newline at end of file
diff --git a/nuspec/nuget/Cake.Issues.MsBuild.nuspec b/nuspec/nuget/Cake.Issues.MsBuild.nuspec
index 73a5486..ab3dd0d 100644
--- a/nuspec/nuget/Cake.Issues.MsBuild.nuspec
+++ b/nuspec/nuget/Cake.Issues.MsBuild.nuspec
@@ -24,27 +24,21 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
Copyright © BBT Software AG and contributors
cake cake-addin cake-issues cake-issueprovider code-analysis linting msbuild
- https://github.com/cake-contrib/Cake.Issues.MsBuild/releases/tag/2.0.0
+ https://github.com/cake-contrib/Cake.Issues.MsBuild/releases/tag/3.0.0
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/recipe.cake b/recipe.cake
index 497553a..af04002 100644
--- a/recipe.cake
+++ b/recipe.cake
@@ -1,4 +1,8 @@
-#load nuget:?package=Cake.Recipe&version=2.2.1
+#load nuget:?package=Cake.Recipe&version=3.0.0
+
+//*************************************************************************************************
+// Settings
+//*************************************************************************************************
Environment.SetVariableNames();
@@ -10,20 +14,20 @@ BuildParameters.SetParameters(
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Issues.MsBuild",
appVeyorAccountName: "cakecontrib",
- shouldRunCoveralls: false, // Disabled because it's currently failing
+ shouldRunCoveralls: false, // Disabled because it's currently failing
+ shouldPostToGitter: false, // Disabled because it's currently failing
shouldGenerateDocumentation: false);
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(
context: Context,
- dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.MsBuild.Tests/**/*.cs", BuildParameters.RootDirectoryPath + "/src/Cake.Issues.MsBuild*/**/*.AssemblyInfo.cs" },
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[Cake.Issues]* -[Cake.Issues.Testing]* -[Shouldly]* -[Microsoft.Build*]* -[StructuredLogger]* -[DiffEngine]* -[EmptyFiles]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
-// Workaround until https://github.com/cake-contrib/Cake.Recipe/issues/862 has been fixed in Cake.Recipe
-ToolSettings.SetToolPreprocessorDirectives(
- reSharperTools: "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2021.2.0");
+//*************************************************************************************************
+// Execution
+//*************************************************************************************************
Build.RunDotNetCore();
diff --git a/src/.editorconfig b/src/.editorconfig
new file mode 100644
index 0000000..bef3dc1
--- /dev/null
+++ b/src/.editorconfig
@@ -0,0 +1,226 @@
+root = true
+# Remove the line below if you want to inherit .editorconfig settings from higher directories
+
+# C# files
+[*.cs]
+
+#### Core EditorConfig Options ####
+
+# Indentation and spacing
+indent_size = 4
+indent_style = space
+tab_width = 4
+
+# New line preferences
+end_of_line = crlf
+insert_final_newline = false
+
+#### .NET Coding Conventions ####
+
+# Organize usings
+dotnet_separate_import_directive_groups = false
+dotnet_sort_system_directives_first = true
+file_header_template =
+
+# this. and Me. preferences
+dotnet_style_qualification_for_event = true
+dotnet_style_qualification_for_field = true
+dotnet_style_qualification_for_method = true
+dotnet_style_qualification_for_property = true
+
+# Language keywords vs BCL types preferences
+dotnet_style_predefined_type_for_locals_parameters_members = true
+dotnet_style_predefined_type_for_member_access = true
+
+# Parentheses preferences
+dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_other_operators = never_if_unnecessary
+dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
+
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = for_non_interface_members
+
+# Expression-level preferences
+dotnet_style_coalesce_expression = true
+dotnet_style_collection_initializer = true
+dotnet_style_explicit_tuple_names = true
+dotnet_style_namespace_match_folder = true
+dotnet_style_null_propagation = true
+dotnet_style_object_initializer = true
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+dotnet_style_prefer_auto_properties = true
+dotnet_style_prefer_compound_assignment = true
+dotnet_style_prefer_conditional_expression_over_assignment = true
+dotnet_style_prefer_conditional_expression_over_return = true
+dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
+dotnet_style_prefer_inferred_anonymous_type_member_names = true
+dotnet_style_prefer_inferred_tuple_names = true
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true
+dotnet_style_prefer_simplified_boolean_expressions = true
+dotnet_style_prefer_simplified_interpolation = true
+
+# Field preferences
+dotnet_style_readonly_field = true
+
+# Parameter preferences
+dotnet_code_quality_unused_parameters = all
+
+# Suppression preferences
+dotnet_remove_unnecessary_suppression_exclusions = 0
+
+# New line preferences
+dotnet_style_allow_multiple_blank_lines_experimental = true
+dotnet_style_allow_statement_immediately_after_block_experimental = true
+
+#### C# Coding Conventions ####
+
+# var preferences
+csharp_style_var_elsewhere = true:suggestion
+csharp_style_var_for_built_in_types = true:suggestion
+csharp_style_var_when_type_is_apparent = true:suggestion
+
+# Expression-bodied members
+csharp_style_expression_bodied_accessors = true
+csharp_style_expression_bodied_constructors = false
+csharp_style_expression_bodied_indexers = true
+csharp_style_expression_bodied_lambdas = true
+csharp_style_expression_bodied_local_functions = false
+csharp_style_expression_bodied_methods = false
+csharp_style_expression_bodied_operators = false
+csharp_style_expression_bodied_properties = true
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_as_with_null_check = true
+csharp_style_pattern_matching_over_is_with_cast_check = true
+csharp_style_prefer_extended_property_pattern = true
+csharp_style_prefer_not_pattern = true
+csharp_style_prefer_pattern_matching = true
+csharp_style_prefer_switch_expression = true
+
+# Null-checking preferences
+csharp_style_conditional_delegate_call = true
+
+# Modifier preferences
+csharp_prefer_static_local_function = true
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
+csharp_style_prefer_readonly_struct = true
+
+# Code-block preferences
+csharp_prefer_braces = true
+csharp_prefer_simple_using_statement = false
+csharp_style_namespace_declarations = block_scoped
+csharp_style_prefer_method_group_conversion = true
+csharp_style_prefer_top_level_statements = true
+
+# Expression-level preferences
+csharp_prefer_simple_default_expression = true
+csharp_style_deconstructed_variable_declaration = true
+csharp_style_implicit_object_creation_when_type_is_apparent = true
+csharp_style_inlined_variable_declaration = true
+csharp_style_prefer_index_operator = true
+csharp_style_prefer_local_over_anonymous_function = true
+csharp_style_prefer_null_check_over_type_check = true
+csharp_style_prefer_range_operator = true
+csharp_style_prefer_tuple_swap = true
+csharp_style_prefer_utf8_string_literals = true
+csharp_style_throw_expression = true
+csharp_style_unused_value_assignment_preference = discard_variable
+csharp_style_unused_value_expression_statement_preference = discard_variable
+
+# 'using' directive preferences
+csharp_using_directive_placement = inside_namespace:error
+
+# New line preferences
+csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
+csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
+csharp_style_allow_embedded_statements_on_same_line_experimental = true
+
+#### C# Formatting Rules ####
+
+# New line preferences
+csharp_new_line_before_catch = true
+csharp_new_line_before_else = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_open_brace = all
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_block_contents = true
+csharp_indent_braces = false
+csharp_indent_case_contents = true
+csharp_indent_case_contents_when_block = true
+csharp_indent_labels = no_change
+csharp_indent_switch_labels = true
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_after_comma = true
+csharp_space_after_dot = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_after_semicolon_in_for_statement = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_around_declaration_statements = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_before_comma = false
+csharp_space_before_dot = false
+csharp_space_before_open_square_brackets = false
+csharp_space_before_semicolon_in_for_statement = false
+csharp_space_between_empty_square_brackets = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_declaration_name_and_open_parenthesis = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_between_square_brackets = false
+
+# Wrapping preferences
+csharp_preserve_single_line_blocks = true
+csharp_preserve_single_line_statements = true
+
+#### Naming styles ####
+
+# Naming rules
+
+dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
+dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
+dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
+
+dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.types_should_be_pascal_case.symbols = types
+dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
+
+dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
+dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
+
+# Symbol specifications
+
+dotnet_naming_symbols.interface.applicable_kinds = interface
+dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.interface.required_modifiers =
+
+dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
+dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.types.required_modifiers =
+
+dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
+dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
+dotnet_naming_symbols.non_field_members.required_modifiers =
+
+# Naming styles
+
+dotnet_naming_style.pascal_case.required_prefix =
+dotnet_naming_style.pascal_case.required_suffix =
+dotnet_naming_style.pascal_case.word_separator =
+dotnet_naming_style.pascal_case.capitalization = pascal_case
+
+dotnet_naming_style.begins_with_i.required_prefix = I
+dotnet_naming_style.begins_with_i.required_suffix =
+dotnet_naming_style.begins_with_i.word_separator =
+dotnet_naming_style.begins_with_i.capitalization = pascal_case
diff --git a/src/Cake.Issues.MsBuild.Tests/BaseMsBuildLogFileFormatTests.cs b/src/Cake.Issues.MsBuild.Tests/BaseMsBuildLogFileFormatTests.cs
index ca738ca..ad6dfad 100644
--- a/src/Cake.Issues.MsBuild.Tests/BaseMsBuildLogFileFormatTests.cs
+++ b/src/Cake.Issues.MsBuild.Tests/BaseMsBuildLogFileFormatTests.cs
@@ -14,7 +14,7 @@ public void Should_Throw_If_FilePath_Is_Null()
{
// Given
var format = new FakeMsBuildLogFileFormat(new FakeLog());
- string filePath = null;
+ const string filePath = null;
var settings = new RepositorySettings(@"c:\repo");
// When
@@ -44,7 +44,7 @@ public void Should_Throw_If_FilePath_Is_WhiteSpace()
{
// Given
var format = new FakeMsBuildLogFileFormat(new FakeLog());
- var filePath = " ";
+ const string filePath = " ";
var settings = new RepositorySettings(@"c:\repo");
// When
@@ -59,8 +59,8 @@ public void Should_Throw_If_Settings_Are_Null()
{
// Given
var format = new FakeMsBuildLogFileFormat(new FakeLog());
- var filePath = @"c:\repo\foo.ch";
- RepositorySettings settings = null;
+ const string filePath = @"c:\repo\foo.ch";
+ const RepositorySettings settings = null;
// When
var result = Record.Exception(() => format.ValidateFilePath(filePath, settings));
@@ -83,10 +83,10 @@ public void Should_Return_Correct_Value_For_Valid(
var settings = new RepositorySettings(repoRoot);
// When
- var result = format.ValidateFilePath(filePath, settings);
+ var (valid, _) = format.ValidateFilePath(filePath, settings);
// Then
- result.Valid.ShouldBe(expectedValue);
+ valid.ShouldBe(expectedValue);
}
[Theory]
@@ -103,10 +103,10 @@ public void Should_Return_Correct_Value_For_FilePath(
var settings = new RepositorySettings(repoRoot);
// When
- var result = format.ValidateFilePath(filePath, settings);
+ var (_, resultFilePath) = format.ValidateFilePath(filePath, settings);
// Then
- result.FilePath.ShouldBe(expectedValue);
+ resultFilePath.ShouldBe(expectedValue);
}
}
}
diff --git a/src/Cake.Issues.MsBuild.Tests/Cake.Issues.MsBuild.Tests.csproj b/src/Cake.Issues.MsBuild.Tests/Cake.Issues.MsBuild.Tests.csproj
index 75779d5..fc7519c 100644
--- a/src/Cake.Issues.MsBuild.Tests/Cake.Issues.MsBuild.Tests.csproj
+++ b/src/Cake.Issues.MsBuild.Tests/Cake.Issues.MsBuild.Tests.csproj
@@ -1,7 +1,7 @@
-
+
- netcoreapp3.1
+ net6.0;net7.0
false
Cake.Issues
Copyright © BBT Software AG and contributors
@@ -24,14 +24,14 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/src/Cake.Issues.MsBuild.Tests/LogFileFormat/BinaryLogFileFormatTests.cs b/src/Cake.Issues.MsBuild.Tests/LogFileFormat/BinaryLogFileFormatTests.cs
index b2ded7b..9df309f 100644
--- a/src/Cake.Issues.MsBuild.Tests/LogFileFormat/BinaryLogFileFormatTests.cs
+++ b/src/Cake.Issues.MsBuild.Tests/LogFileFormat/BinaryLogFileFormatTests.cs
@@ -16,7 +16,7 @@ public sealed class TheCtor
public void Should_Throw_If_Log_Is_Null()
{
// Given
- ICakeLog log = null;
+ const ICakeLog log = null;
// When
var result = Record.Exception(() => new BinaryLogFileFormat(log));
@@ -199,7 +199,7 @@ public void Should_Read_Full_Log_Correct()
"Cake.Issues.MsBuild.MsBuildIssuesProvider",
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
- .OfRule("CA2210", new Uri("https://www.google.com/search?q=\"CA2210:\"+site:docs.microsoft.com"))
+ .OfRule("CA2210", new Uri("https://www.google.com/search?q=\"CA2210:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[16],
@@ -208,7 +208,7 @@ public void Should_Read_Full_Log_Correct()
"Cake.Issues.MsBuild.MsBuildIssuesProvider",
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
- .OfRule("CA1014", new Uri("https://www.google.com/search?q=\"CA1014:\"+site:docs.microsoft.com"))
+ .OfRule("CA1014", new Uri("https://www.google.com/search?q=\"CA1014:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[17],
@@ -218,7 +218,7 @@ public void Should_Read_Full_Log_Correct()
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
.InFile(@"src\ClassLibrary1\Class1.cs", 12)
- .OfRule("CA1822", new Uri("https://www.google.com/search?q=\"CA1822:\"+site:docs.microsoft.com"))
+ .OfRule("CA1822", new Uri("https://www.google.com/search?q=\"CA1822:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[18],
@@ -228,7 +228,7 @@ public void Should_Read_Full_Log_Correct()
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
.InFile(@"src\ClassLibrary1\Class1.cs", 13)
- .OfRule("CA1804", new Uri("https://www.google.com/search?q=\"CA1804:\"+site:docs.microsoft.com"))
+ .OfRule("CA1804", new Uri("https://www.google.com/search?q=\"CA1804:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
}
}
diff --git a/src/Cake.Issues.MsBuild.Tests/LogFileFormat/XmlFileLoggerLogFileFormatTests.cs b/src/Cake.Issues.MsBuild.Tests/LogFileFormat/XmlFileLoggerLogFileFormatTests.cs
index 6d05345..bddb625 100644
--- a/src/Cake.Issues.MsBuild.Tests/LogFileFormat/XmlFileLoggerLogFileFormatTests.cs
+++ b/src/Cake.Issues.MsBuild.Tests/LogFileFormat/XmlFileLoggerLogFileFormatTests.cs
@@ -17,7 +17,7 @@ public sealed class TheCtor
public void Should_Throw_If_Log_Is_Null()
{
// Given
- ICakeLog log = null;
+ const ICakeLog log = null;
// When
var result = Record.Exception(() => new XmlFileLoggerLogFileFormat(log));
@@ -197,7 +197,7 @@ public void Should_Read_Full_Log_Correct()
"Cake.Issues.MsBuild.MsBuildIssuesProvider",
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
- .OfRule("CA2210", new Uri("https://www.google.com/search?q=\"CA2210:\"+site:docs.microsoft.com"))
+ .OfRule("CA2210", new Uri("https://www.google.com/search?q=\"CA2210:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[16],
@@ -206,7 +206,7 @@ public void Should_Read_Full_Log_Correct()
"Cake.Issues.MsBuild.MsBuildIssuesProvider",
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
- .OfRule("CA1014", new Uri("https://www.google.com/search?q=\"CA1014:\"+site:docs.microsoft.com"))
+ .OfRule("CA1014", new Uri("https://www.google.com/search?q=\"CA1014:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[17],
@@ -216,7 +216,7 @@ public void Should_Read_Full_Log_Correct()
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
.InFile(@"src\ClassLibrary1\Class1.cs", 12)
- .OfRule("CA1822", new Uri("https://www.google.com/search?q=\"CA1822:\"+site:docs.microsoft.com"))
+ .OfRule("CA1822", new Uri("https://www.google.com/search?q=\"CA1822:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[18],
@@ -226,7 +226,7 @@ public void Should_Read_Full_Log_Correct()
"MSBuild")
.InProject(@"src\ClassLibrary1\ClassLibrary1.csproj", "ClassLibrary1")
.InFile(@"src\ClassLibrary1\Class1.cs", 13)
- .OfRule("CA1804", new Uri("https://www.google.com/search?q=\"CA1804:\"+site:docs.microsoft.com"))
+ .OfRule("CA1804", new Uri("https://www.google.com/search?q=\"CA1804:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
}
@@ -249,7 +249,7 @@ public void Should_Read_Issue_With_File_Correct()
"MSBuild")
.InProjectOfName(string.Empty)
.InFile(@"src\Cake.Issues.MsBuild.Tests\MsBuildIssuesProviderTests.cs", 1311)
- .OfRule("CA2201", new Uri("https://www.google.com/search?q=\"CA2201:\"+site:docs.microsoft.com"))
+ .OfRule("CA2201", new Uri("https://www.google.com/search?q=\"CA2201:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
}
@@ -317,7 +317,7 @@ public void Should_Read_Issue_Without_File_Correct()
"Cake.Issues.MsBuild.MsBuildIssuesProvider",
"MSBuild")
.InProjectOfName(string.Empty)
- .OfRule("CA1711", new Uri("https://www.google.com/search?q=\"CA1711:\"+site:docs.microsoft.com"))
+ .OfRule("CA1711", new Uri("https://www.google.com/search?q=\"CA1711:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
}
@@ -445,7 +445,7 @@ public void Should_Read_Both_Warnings_And_Errors()
"MSBuild")
.InProjectOfName(string.Empty)
.InFile(@"src\Cake.Issues.MsBuild.Tests\MsBuildIssuesProviderTests.cs", 1311)
- .OfRule("CA2201", new Uri("https://www.google.com/search?q=\"CA2201:\"+site:docs.microsoft.com"))
+ .OfRule("CA2201", new Uri("https://www.google.com/search?q=\"CA2201:\"+site:learn.microsoft.com"))
.WithPriority(IssuePriority.Warning));
IssueChecker.Check(
issues[1],
diff --git a/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesProviderTests.cs b/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesProviderTests.cs
index c55b62b..fe45a54 100644
--- a/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesProviderTests.cs
+++ b/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesProviderTests.cs
@@ -14,7 +14,7 @@ public sealed class TheCtor
public void Should_Throw_If_Log_Is_Null()
{
// Given
- ICakeLog log = null;
+ const ICakeLog log = null;
var settings =
new MsBuildIssuesSettings(
"Foo".ToByteArray(),
@@ -32,7 +32,7 @@ public void Should_Throw_If_IssueProviderSettings_Are_Null()
{
// Given
var log = new FakeLog();
- MsBuildIssuesSettings settings = null;
+ const MsBuildIssuesSettings settings = null;
// When
var result = Record.Exception(() => new MsBuildIssuesProvider(log, settings));
diff --git a/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesSettingsTests.cs b/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesSettingsTests.cs
index bcd1a22..ef31b6f 100644
--- a/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesSettingsTests.cs
+++ b/src/Cake.Issues.MsBuild.Tests/MsBuildIssuesSettingsTests.cs
@@ -16,7 +16,7 @@ public sealed class TheCtor
public void Should_Throw_If_LogFilePath_Is_Null()
{
// Given
- FilePath logFilePath = null;
+ const FilePath logFilePath = null;
var format = new XmlFileLoggerLogFileFormat(new FakeLog());
// When
@@ -30,7 +30,7 @@ public void Should_Throw_If_LogFilePath_Is_Null()
public void Should_Throw_If_Format_For_LogFilePath_Is_Null()
{
// Given
- BaseMsBuildLogFileFormat format = null;
+ const BaseMsBuildLogFileFormat format = null;
using (var tempFile = new ResourceTempFile("Cake.Issues.MsBuild.Tests.Testfiles.XmlFileLoggerLogFileFormat.FullLog.xml"))
{
@@ -47,7 +47,7 @@ public void Should_Throw_If_Format_For_LogFilePath_Is_Null()
public void Should_Throw_If_LogFileContent_Is_Null()
{
// Given
- byte[] logFileContent = null;
+ const byte[] logFileContent = null;
var format = new XmlFileLoggerLogFileFormat(new FakeLog());
// When
@@ -62,7 +62,7 @@ public void Should_Throw_If_Format_For_LogFileContent_Is_Null()
{
// Given
var logFileContent = "foo".ToByteArray();
- BaseMsBuildLogFileFormat format = null;
+ const BaseMsBuildLogFileFormat format = null;
// When
var result = Record.Exception(() =>
@@ -90,7 +90,7 @@ public void Should_Set_LogFileContent()
public void Should_Set_LogFileContent_If_Empty()
{
// Given
- byte[] logFileContent = Array.Empty();
+ var logFileContent = Array.Empty();
var format = new XmlFileLoggerLogFileFormat(new FakeLog());
// When
diff --git a/src/Cake.Issues.MsBuild.Tests/MsBuildRuleUrlResolverTests.cs b/src/Cake.Issues.MsBuild.Tests/MsBuildRuleUrlResolverTests.cs
index d2aaa11..2001904 100644
--- a/src/Cake.Issues.MsBuild.Tests/MsBuildRuleUrlResolverTests.cs
+++ b/src/Cake.Issues.MsBuild.Tests/MsBuildRuleUrlResolverTests.cs
@@ -40,8 +40,10 @@ public void Should_Throw_If_Rule_Is_WhiteSpace()
}
[Theory]
- [InlineData("CA2201", "https://www.google.com/search?q=\"CA2201:\"+site:docs.microsoft.com")]
+ [InlineData("CA2201", "https://www.google.com/search?q=\"CA2201:\"+site:learn.microsoft.com")]
[InlineData("SA1652", "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1652.md")]
+ [InlineData("S1075", "https://rules.sonarsource.com/csharp/RSPEC-1075")]
+ [InlineData("RCS1001", "https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1001.md")]
public void Should_Resolve_Url(string rule, string expectedUrl)
{
// Given
diff --git a/src/Cake.Issues.MsBuild/Cake.Issues.MsBuild.csproj b/src/Cake.Issues.MsBuild/Cake.Issues.MsBuild.csproj
index c033856..f5a838d 100644
--- a/src/Cake.Issues.MsBuild/Cake.Issues.MsBuild.csproj
+++ b/src/Cake.Issues.MsBuild/Cake.Issues.MsBuild.csproj
@@ -1,7 +1,7 @@
- netcoreapp3.1;net5.0;net6.0
+ net6.0;net7.0
MsBuild support for the Cake.Issues Addin for Cake Build Automation System
BBT Software AG
BBT Software AG
@@ -19,13 +19,13 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/Cake.Issues.MsBuild/LogFileFormat/BinaryLogFileFormat.cs b/src/Cake.Issues.MsBuild/LogFileFormat/BinaryLogFileFormat.cs
index 0642180..752d58b 100644
--- a/src/Cake.Issues.MsBuild/LogFileFormat/BinaryLogFileFormat.cs
+++ b/src/Cake.Issues.MsBuild/LogFileFormat/BinaryLogFileFormat.cs
@@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;
+ using System.Linq;
using Cake.Core.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Logging.StructuredLogger;
@@ -26,23 +27,15 @@ public override IEnumerable ReadIssues(
IRepositorySettings repositorySettings,
MsBuildIssuesSettings issueProviderSettings)
{
-#pragma warning disable SA1123 // Do not place regions within elements
- #region DupFinder Exclusion
-#pragma warning restore SA1123 // Do not place regions within elements
-
issueProvider.NotNull(nameof(issueProvider));
repositorySettings.NotNull(nameof(repositorySettings));
issueProviderSettings.NotNull(nameof(issueProviderSettings));
- #endregion
-
var result = new List();
var binLogReader = new BinLogReader();
- foreach (var record in binLogReader.ReadRecords(issueProviderSettings.LogFileContent))
+ foreach (var buildEventArgs in binLogReader.ReadRecords(issueProviderSettings.LogFileContent).Select(x => x.Args))
{
- var buildEventArgs = record.Args;
-
IIssue issue = null;
if (buildEventArgs is BuildErrorEventArgs buildError)
{
diff --git a/src/Cake.Issues.MsBuild/LogFileFormat/XmlFileLoggerLogFileFormat.cs b/src/Cake.Issues.MsBuild/LogFileFormat/XmlFileLoggerLogFileFormat.cs
index fa750cc..e61df4b 100644
--- a/src/Cake.Issues.MsBuild/LogFileFormat/XmlFileLoggerLogFileFormat.cs
+++ b/src/Cake.Issues.MsBuild/LogFileFormat/XmlFileLoggerLogFileFormat.cs
@@ -27,16 +27,10 @@ public override IEnumerable ReadIssues(
IRepositorySettings repositorySettings,
MsBuildIssuesSettings issueProviderSettings)
{
-#pragma warning disable SA1123 // Do not place regions within elements
- #region DupFinder Exclusion
-#pragma warning restore SA1123 // Do not place regions within elements
-
issueProvider.NotNull(nameof(issueProvider));
repositorySettings.NotNull(nameof(repositorySettings));
issueProviderSettings.NotNull(nameof(issueProviderSettings));
- #endregion
-
var result = new List();
// Read log file.
@@ -153,8 +147,7 @@ private bool TryGetProject(
}
// Validate project path and make relative to repository root.
- bool result;
- (result, project) = this.ValidateFilePath(project, repositorySettings);
+ (var result, project) = this.ValidateFilePath(project, repositorySettings);
return result;
}
@@ -202,8 +195,7 @@ private bool TryGetFile(
}
// Validate file path and make relative to repository root.
- bool result;
- (result, fileName) = this.ValidateFilePath(fileName, repositorySettings);
+ (var result, fileName) = this.ValidateFilePath(fileName, repositorySettings);
return result;
}
diff --git a/src/Cake.Issues.MsBuild/MsBuildRuleUrlResolver.cs b/src/Cake.Issues.MsBuild/MsBuildRuleUrlResolver.cs
index 3d0ac01..a0022be 100644
--- a/src/Cake.Issues.MsBuild/MsBuildRuleUrlResolver.cs
+++ b/src/Cake.Issues.MsBuild/MsBuildRuleUrlResolver.cs
@@ -9,7 +9,7 @@
internal class MsBuildRuleUrlResolver : BaseRuleUrlResolver
{
private static readonly Lazy InstanceValue =
- new Lazy(() => new MsBuildRuleUrlResolver());
+ new (() => new MsBuildRuleUrlResolver());
///
/// Initializes a new instance of the class.
@@ -17,14 +17,30 @@ internal class MsBuildRuleUrlResolver : BaseRuleUrlResolver
x.Category.ToUpperInvariant() == "CA" ?
- new Uri("https://www.google.com/search?q=%22" + x.Rule + ":%22+site:docs.microsoft.com") :
+ new Uri("https://www.google.com/search?q=%22" + x.Rule + ":%22+site:learn.microsoft.com") :
null);
+
+ // StyleCop analyzer rules
this.AddUrlResolver(x =>
x.Category.ToUpperInvariant() == "SA" ?
new Uri("https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/" + x.Rule + ".md") :
null);
+
+ // SonarLint rules
+ this.AddUrlResolver(x =>
+ x.Category.ToUpperInvariant() == "S" ?
+ new Uri("https://rules.sonarsource.com/csharp/RSPEC-" + x.RuleId) :
+ null);
+
+ // Roslynator rules
+ this.AddUrlResolver(x =>
+ x.Category.ToUpperInvariant() == "RCS" ?
+ new Uri("https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/" + x.Rule + ".md") :
+ null);
}
///
@@ -58,8 +74,7 @@ protected override bool TryGetRuleDescription(string rule, MsBuildRuleDescriptio
}
// Try to parse the part after the first number to an integer.
- int ruleId;
- if (!int.TryParse(rule.Substring(digitIndex), out ruleId))
+ if (!int.TryParse(rule.AsSpan(digitIndex), out var ruleId))
{
return false;
}
diff --git a/tools/packages.config b/tools/packages.config
deleted file mode 100644
index ef49ed4..0000000
--- a/tools/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file