From 1a77cbdbb984efb1cee6017250853980c0bc4aba Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 22 Aug 2021 22:47:16 +0200 Subject: [PATCH 01/15] Setup project (#1) --- .appveyor.yml | 34 +++ .gitattributes | 63 +++++ .gitignore | 10 + CONTRIBUTING.md | 35 +++ GitReleaseManager.yaml | 12 + README.md | 45 ++- azure-pipelines.yml | 18 ++ build.ps1 | 261 ++++++++++++++++++ build.sh | 116 ++++++++ ...e.Frosting.Issues.Reporting.Console.nuspec | 47 ++++ .../Cake.Issues.Reporting.Console.nuspec | 40 +++ nuspec/nuget/icon.png | Bin 0 -> 15893 bytes recipe.cake | 23 ++ ...ake.Issues.Reporting.Console.Tests.ruleset | 10 + ...Cake.Issues.Reporting.Console.Tests.csproj | 55 ++++ .../ConsoleIssueReportFixture.cs | 60 ++++ .../ConsoleIssueReportGeneratorTests.cs | 52 ++++ .../Properties/SolutionInfo.cs | 16 ++ src/Cake.Issues.Reporting.Console.ruleset | 241 ++++++++++++++++ src/Cake.Issues.Reporting.Console.sln | 44 +++ ...e.Issues.Reporting.Console.sln.DotSettings | 3 + .../Cake.Issues.Reporting.Console.csproj | 44 +++ .../ConsoleIssueReportFormatAliases.cs | 73 +++++ .../ConsoleIssueReportFormatSettings.cs | 9 + .../ConsoleIssueReportGenerator.cs | 33 +++ .../Properties/SolutionInfo.cs | 21 ++ tools/packages.config | 4 + 27 files changed, 1367 insertions(+), 2 deletions(-) create mode 100644 .appveyor.yml create mode 100644 .gitattributes create mode 100644 CONTRIBUTING.md create mode 100644 GitReleaseManager.yaml create mode 100644 azure-pipelines.yml create mode 100644 build.ps1 create mode 100644 build.sh create mode 100644 nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec create mode 100644 nuspec/nuget/Cake.Issues.Reporting.Console.nuspec create mode 100644 nuspec/nuget/icon.png create mode 100644 recipe.cake create mode 100644 src/Cake.Issues.Reporting.Console.Tests.ruleset create mode 100644 src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj create mode 100644 src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs create mode 100644 src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs create mode 100644 src/Cake.Issues.Reporting.Console.Tests/Properties/SolutionInfo.cs create mode 100644 src/Cake.Issues.Reporting.Console.ruleset create mode 100644 src/Cake.Issues.Reporting.Console.sln create mode 100644 src/Cake.Issues.Reporting.Console.sln.DotSettings create mode 100644 src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj create mode 100644 src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs create mode 100644 src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs create mode 100644 src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs create mode 100644 src/Cake.Issues.Reporting.Console/Properties/SolutionInfo.cs create mode 100644 tools/packages.config diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..47c75d4 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,34 @@ +#---------------------------------# +# Build Image # +#---------------------------------# +image: Visual Studio 2019 + +#---------------------------------# +# Build Script # +#---------------------------------# +install: + # Update to latest NuGet version since we require 5.3.0 for embedded icon + - ps: nuget update -self + +build_script: + - ps: .\build.ps1 -Target CI + +# Tests +test: off + +#---------------------------------# +# Branches to build # +#---------------------------------# +branches: + # Whitelist + only: + - develop + - main + - /release/.*/ + - /hotfix/.*/ + +#---------------------------------# +# Build Cache # +#---------------------------------# +cache: +- tools -> recipe.cake \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index dfcfd56..4785f2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,13 @@ +# Project specific + +BuildArtifacts/ + +# Created by https://www.gitignore.io/api/cake,visualstudio + +### Cake ### +tools/* +!tools/packages.config + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..078295e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contribution Guidelines + +This repository uses [GitFlow] with default configuration. +Development is happening on `develop` branch. + +To contribute: + +* Fork this repository. +* Create a feature branch from `develop`. +* Implement your changes. +* Push your feature branch. +* Create a pull request. + +## Build + +To build this package we are using Cake. + +On Windows PowerShell run: + +```powershell +./build +``` + +On OSX/Linux run: + +```bash +./build.sh +``` + +## Release + +See [Cake.Recipe documentation] how to create a new release of this addin. + +[GitFlow]: (http://nvie.com/posts/a-successful-git-branching-model/) +[Cake.Recipe documentation]: https://cake-contrib.github.io/Cake.Recipe/docs/usage/creating-release \ No newline at end of file diff --git a/GitReleaseManager.yaml b/GitReleaseManager.yaml new file mode 100644 index 0000000..721c1ba --- /dev/null +++ b/GitReleaseManager.yaml @@ -0,0 +1,12 @@ +issue-labels-include: +- Breaking change +- Feature +- Bug +- Improvement +- Documentation +issue-labels-exclude: +- Build +issue-labels-alias: + - name: Documentation + header: Documentation + plural: Documentation \ No newline at end of file diff --git a/README.md b/README.md index 196825e..a26ca46 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ -# Cake.Issues.Reporting.Console -Addin for reporting issues to the console +# Console reporting for Cake.Issues Addin + +This addin for the Cake Build Automation System allows you to report issues found using any code analyzer or linter with +the [Cake Issues addin](https://github.com/cake-contrib/Cake.Issues) to the console. + +It is built using [Errata](https://github.com/spectreconsole/errata). + +For more information about this addin see the [Cake.Issues website](https://cakeissues.net) +and for general information about the Cake build automation system see the [Cake website](http://cakebuild.net). + +[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/cake-contrib/Cake.Issues.Reporting.Console/blob/feature/build/LICENSE) + +## Information + +| | Stable | Pre-release | +|:--:|:--:|:--:| +|GitHub Release|-|[![GitHub release](https://img.shields.io/github/release/cake-contrib/Cake.Issues.Reporting.Console.svg)](https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/latest)| +|NuGet|[![NuGet](https://img.shields.io/nuget/v/Cake.Issues.Reporting.Console.svg)](https://www.nuget.org/packages/Cake.Issues.Reporting.Console)|[![NuGet](https://img.shields.io/nuget/vpre/Cake.Issues.Reporting.Console.svg)](https://www.nuget.org/packages/Cake.Issues.Reporting.Console)| + +## Build Status + +| | Develop | Main | +|:--:|:--:|:--:| +|AppVeyor Windows|[![Build status](https://ci.appveyor.com/api/projects/status/hyqj9655m5ua0bhh/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-issues-reporting-console/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/hyqj9655m5ua0bhh/branch/main?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-issues-reporting-console/branch/main)| +|Azure DevOps Windows|[![Build Status](https://dev.azure.com/cake-contrib/Cake.Issues.Reporting.Console/_apis/build/status/cake-contrib.Cake.Issues.Reporting.Console?branchName=develop&jobName=Windows)](https://dev.azure.com/cake-contrib/Cake.Issues.Reporting.Console/_build/latest?definitionId=32&branchName=develop)|[![Build Status](https://dev.azure.com/cake-contrib/Cake.Issues.Reporting.Console/_apis/build/status/cake-contrib.Cake.Issues.Reporting.Console?branchName=main&jobName=Windows)](https://dev.azure.com/cake-contrib/Cake.Issues.Reporting.Console/_build/latest?definitionId=32&branchName=main)| + +## Code Coverage + +[![Coverage Status](https://coveralls.io/repos/github/cake-contrib/Cake.Issues.Reporting.Console/badge.svg?branch=develop)](https://coveralls.io/github/cake-contrib/Cake.Issues.Reporting.Console?branch=develop) + +## Quick Links + +- [Documentation](https://cakeissues.net) + +## Discussion + +For questions and to discuss ideas & feature requests, use the [GitHub discussions on the Cake GitHub repository](https://github.com/cake-build/cake/discussions), under the [Extension Q&A](https://github.com/cake-build/cake/discussions/categories/extension-q-a) category. + +[![Join in the discussion on the Cake repository](https://img.shields.io/badge/GitHub-Discussions-green?logo=github)](https://github.com/cake-build/cake/discussions) + +## Contributing + +Contributions are welcome. See [Contribution Guidelines](CONTRIBUTING.md). \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..e6f836f --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,18 @@ +trigger: +- develop +- main +- release/* +- hotfix/* + +pr: +- develop +- release/* +- hotfix/* + +jobs: +- job: Windows + pool: + vmImage: 'windows-2019' + steps: + - powershell: ./build.ps1 + displayName: 'Cake Build' \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..285bb72 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,261 @@ +########################################################################## +# This is the Cake bootstrapper script for PowerShell. +# Based on boostrapper from https://github.com/cake-build/resources +########################################################################## + +<# + +.SYNOPSIS +This is a Powershell script to bootstrap a Cake build. + +.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. + +.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 diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..878a2f2 --- /dev/null +++ b/build.sh @@ -0,0 +1,116 @@ +#!/usr/bin/env bash + +########################################################################## +# This is the Cake bootstrapper script for Linux and OS X. +# Based on bootstrapper from https://github.com/cake-build/resources +########################################################################## + +# 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 + +# 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 diff --git a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec new file mode 100644 index 0000000..843bf82 --- /dev/null +++ b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec @@ -0,0 +1,47 @@ + + + + Cake.Frosting.Issues.Reporting.Console + Cake.Frosting.Issues.Reporting.Console + 0.0.0 + Pascal Berger + pascalberger, cake-contrib + Support for reporting issues to console for the Cake.Issues addin for Cake Frosting + +The addin for the Cake.Issues addin for Cake Frosting allows you to print issues to the console. + +This addin provides the aliases for reporting issues to the console. +It also requires the core Cake.Issues and Cake.Issues.Reporting addins and one or more issue providers. + +See the Project Site for an overview of the whole ecosystem of addins for working with issues in Cake scripts. + +NOTE: +This is the version of the addin compatible with Cake Frosting. +For addin compatible with Cake Script Runners see Cake.Issues.Reporting.Console. + +The addin requires .NET 5.0. + + MIT + https://cakeissues.net + icon.png + false + + Copyright © Pascal Berger + cake cake-addin cake-issues cake-reportformat issues reporting console + https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/1.0.0 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec new file mode 100644 index 0000000..260bbcf --- /dev/null +++ b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec @@ -0,0 +1,40 @@ + + + + Cake.Issues.Reporting.Console + Cake.Issues.Reporting.Console + 0.0.0 + Pascal Berger + pascalberger, cake-contrib + Support for reporting issues to console for the Cake.Issues addin for Cake Build Automation System + +This addin for the Cake.Issues addin for Cake .NET Tool allows you to print issues to the console. + +This addin provides the aliases for reporting issues to the console. +It also requires the core Cake.Issues and Cake.Issues.Reporting addins and one or more issue providers. + +See the Project Site for an overview of the whole ecosystem of addins for working with issues in Cake scripts. + +NOTE: +This is the version of the addin compatible with Cake .NET Tool. +For addin compatible with Cake Frosting see Cake.Frosting.Issues.Reporting.Console. + +The addin requires .NET 5.0. + + MIT + https://cakeissues.net + icon.png + false + + Copyright © Pascal Berger + cake cake-addin cake-issues cake-reportformat issues reporting console + https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/1.0.0 + + + + + + + + + \ No newline at end of file diff --git a/nuspec/nuget/icon.png b/nuspec/nuget/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..84c2a823c7b1757c9f61013337351de45a309ccc GIT binary patch literal 15893 zcmY*gWl$W?)80EcoWKz*xCZy&b~wQu65I(Pxa(oTU4py2BuH=w0YZS_?(XjP^80^# zuWDineYX94ltyNqIP&A(jqM=K3IKgb)QHS8gDEbt zZC$g3_mnmr+^=T2S7`WLr(kt&V})Lk8?9s3dIO)=-GjdnqF~1|Gxs8qqR=>#vv43g zm278;T>CuhPpa#yYwAzBIJ;awpBspN^0fF_?sfNk@Aup>o}g45*0ZYd*5Ju)+n$lY z7U0W3`$`PFDh^mhg7=gfJ#3zgwFvg42S3{$hDna#-8%AR#OD^|1B;ofmy+LuL#N&! z`67LV6C=E$6Q%tO1nEB;Q=xr+Aml|NiAJKe1bzzkM0Iy}46IZ;ns%=C(=#AYFh6OV z$9G^iaja+vX~-eL_>N6SSsQM0n_nI<(;5Roz0cNJ=k0j*rk$nqdUn7C^HW1`rt{$9 z_2`XNqN~U=^Wj6IWu?2dEe4-?OgSbztG8n-9@BYxU0Ll*&q0hrr1Y*E+r!uYc*3gU z1_FBQs;5$)(}+bB4Lwf0(qej|Kq2|jOqg&oyXUAzza$Z-zGXsBy%%yBdJEP-gH`YC zvHOYYT|Xvon&+#R$0P(q@T1|AFOnCrbJrd2)1v>1*dCe-M+Txm#cB>oAnXiZuZi~R z?Z0;TFK;IW&0};L{BU|MByWpuKfOtaHo)RV%5d!CM#^d7^5%su7G4Pdx+V8n{gI)P zJ^nIH1{po$|5i$0(pmiQK1Qe`FuC0>s-B<_6xkIa>K9<(eTORGyTZamc7_dYlaR!^ zkj(4&vHz2wgx{6}K)Kb=y$}}6@YNdg+j@8C{lu$96o>*{l#x_+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`{+d;$jS*bgzk8pmW(;}{iSfE zk!Ft-Glj$x75WLD+vRN5&1v;Of4|b=6)Wbf6zOQX^#X4KU-}91FaD-nIJS>+6jPtw)qzIQ>&>Nn!hy^S5Fsd! zmSK2YCjI`GFl1d#_}Z!J@3}$v@0A2eGnp^%JPQ{!2NZ=Wg2+Lf^u8skeuiOItw&6V zrln}&4)jegZ5ITneL=@YID%<6Y2Hk^up|HOm5615zps!O2yi82+tI!#g`3euWx!h| zF^Wi5n@&W7i6^@HLU%q=-BCbUsPldcWsCLS^M>spzu?EO-x}h}fNTLydLqCtm=PfH zd1u6!6I-LJOcNe2*;^<1o=V5=rSpXAygDEs`K2e)>165?5r8v%ll*%T@}sk`t;e1m zjwEuJSre~{k?JUiWedD3nE=rWprE6QW#EJm1DH26oQh2#dW0s>KMK;ApI38wop*A6 z2!HBv~#i0q*FI7tjiQ*g-rUDFQXa$6sNNoWclyNiMO#cKs?@FC-=7PI7 z^oqDwcTHgWm-kZ!7vRj#dP(0Kc%MRYO`tvuv@&f06QY6AlW12z+(vuO28@<@9xg}sv|U-6-E1vpVw#S z-e#Nk!`@%7>m<|#!0H^JxN1;YOTSKaz(;cm2|G8J?@AwA+OT^L6%_fy$8k?5^8}6qJ!l=C;#lWf@1q*wq|5FK7irrd#rX5zjQ+iMvm|udA?G|N>aBdgpip-1JY@xYl;-O<95J}SeFVbX048CchvSL}fc~WW6RtHox?m z8;^);v_N729ZH3$g20>9Pis28{MYm$>4goRmr|v6HF_#e4bc_$>rS0h{f@d-q)ur) zE0nx$j!omNsXGWMffrzvU`L}N43ds27i3tvG1 + + + + + + + + + \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj new file mode 100644 index 0000000..b7051aa --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj @@ -0,0 +1,55 @@ + + + + Library + net5.0 + false + Tests for the Cake.Issues.Reporting.Console addin + Pascal Berger + Cake.Issues + Copyright © Pascal Berger + + + ..\Cake.Issues.Reporting.Console.Tests.ruleset + + + ..\Cake.Issues.Reporting.Console.Tests.ruleset + + + + + + + + + + 1.0.0 + + + 1.0.0 + + + 1.0.0 + + + 1.0.0 + + + 4.0.3 + + + 1.1.118 + runtime; build; native; contentfiles; analyzers + all + + + + 2.4.1 + + + 2.4.3 + runtime; build; native; contentfiles; analyzers + all + + + \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs new file mode 100644 index 0000000..5901f83 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs @@ -0,0 +1,60 @@ +namespace Cake.Issues.Reporting.Console.Tests +{ + using System; + using System.Collections.Generic; + using Cake.Core.Diagnostics; + using Cake.Testing; + using Shouldly; + + internal class ConsoleIssueReportFixture + { + public const string RepositoryRootPath = @"c:\Source\Cake.Issues.Reporting.Console"; + + public ConsoleIssueReportFixture() + { + this.Log = new FakeLog { Verbosity = Verbosity.Normal }; + this.ConsoleIssueReportFormatSettings = new ConsoleIssueReportFormatSettings(); + } + + public FakeLog Log { get; set; } + + public ConsoleIssueReportFormatSettings ConsoleIssueReportFormatSettings { get; set; } + + public string CreateReport(IEnumerable issues) + { + var generator = + new ConsoleIssueReportGenerator(this.Log, this.ConsoleIssueReportFormatSettings); + + var createIssueReportSettings = + new CreateIssueReportSettings(RepositoryRootPath, string.Empty); + generator.Initialize(createIssueReportSettings); + generator.CreateReport(issues); + + // TODO Return console output + return string.Empty; + } + + public void TestReportCreation(Action settings) + { + // Given + settings(this.ConsoleIssueReportFormatSettings); + + // When + var result = + this.CreateReport( + new List + { + IssueBuilder + .NewIssue("Message Foo", "ProviderType Foo", "ProviderName Foo") + .InFile(@"src\Cake.Issues.Reporting.Generic.Tests\Foo.cs", 10) + .OfRule("Rule Foo") + .WithPriority(IssuePriority.Warning) + .Create(), + }); + + // Then + // Currently only checks if generation failed or not without checking actual output. + result.ShouldNotBeNull(); + } + } +} diff --git a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs new file mode 100644 index 0000000..db18786 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs @@ -0,0 +1,52 @@ +namespace Cake.Issues.Reporting.Console.Tests +{ + using Cake.Core.IO; + using Cake.Issues.Testing; + using Cake.Testing; + using Xunit; + + public sealed class ConsoleIssueReportGeneratorTests + { + public sealed class TheCtor + { + [Fact] + public void Should_Throw_If_Log_Is_Null() + { + // Given / When + var result = Record.Exception(() => + new ConsoleIssueReportGenerator( + null, + new ConsoleIssueReportFormatSettings())); + + // Then + result.IsArgumentNullException("log"); + } + + [Fact] + public void Should_Throw_If_Settings_Are_Null() + { + // Given / When + var result = Record.Exception(() => + new ConsoleIssueReportGenerator( + new FakeLog(), + null)); + + // Then + result.IsArgumentNullException("settings"); + } + } + + public sealed class TheInternalCreateReportMethod + { + [Fact] + public void Should_Generate_Report() + { + // Given + + // When + + // Then + } + } + } +} diff --git a/src/Cake.Issues.Reporting.Console.Tests/Properties/SolutionInfo.cs b/src/Cake.Issues.Reporting.Console.Tests/Properties/SolutionInfo.cs new file mode 100644 index 0000000..3b34026 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/Properties/SolutionInfo.cs @@ -0,0 +1,16 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a6ec509d-8ddc-4ec8-ba7e-a173f48e61fa")] diff --git a/src/Cake.Issues.Reporting.Console.ruleset b/src/Cake.Issues.Reporting.Console.ruleset new file mode 100644 index 0000000..f906431 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.ruleset @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console.sln b/src/Cake.Issues.Reporting.Console.sln new file mode 100644 index 0000000..7add30c --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.sln @@ -0,0 +1,44 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31515.178 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Issues.Reporting.Console", "Cake.Issues.Reporting.Console\Cake.Issues.Reporting.Console.csproj", "{95DCB140-6E3A-4F24-B0AD-2254CA946302}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Issues.Reporting.Console.Tests", "Cake.Issues.Reporting.Console.Tests\Cake.Issues.Reporting.Console.Tests.csproj", "{1BEFC7DD-013C-4B9E-AA65-20AD5BCCAA97}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{44A982C3-1A02-497A-96B0-238D1F181BD5}" + ProjectSection(SolutionItems) = preProject + ..\setup.cake = ..\setup.cake + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspec", "nuspec", "{8419B5EA-AC0C-41FD-AFB3-28FAE7B63CB1}" + ProjectSection(SolutionItems) = preProject + ..\nuspec\nuget\Cake.Issues.Reporting.Console.nuspec = ..\nuspec\nuget\Cake.Issues.Reporting.Console.nuspec + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95DCB140-6E3A-4F24-B0AD-2254CA946302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95DCB140-6E3A-4F24-B0AD-2254CA946302}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95DCB140-6E3A-4F24-B0AD-2254CA946302}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95DCB140-6E3A-4F24-B0AD-2254CA946302}.Release|Any CPU.Build.0 = Release|Any CPU + {1BEFC7DD-013C-4B9E-AA65-20AD5BCCAA97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1BEFC7DD-013C-4B9E-AA65-20AD5BCCAA97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1BEFC7DD-013C-4B9E-AA65-20AD5BCCAA97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1BEFC7DD-013C-4B9E-AA65-20AD5BCCAA97}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {8419B5EA-AC0C-41FD-AFB3-28FAE7B63CB1} = {44A982C3-1A02-497A-96B0-238D1F181BD5} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CCFA51F0-9CFE-43CC-AC63-4827BF3D9C46} + EndGlobalSection +EndGlobal diff --git a/src/Cake.Issues.Reporting.Console.sln.DotSettings b/src/Cake.Issues.Reporting.Console.sln.DotSettings new file mode 100644 index 0000000..7cc51a4 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.sln.DotSettings @@ -0,0 +1,3 @@ + + DO_NOT_SHOW + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj new file mode 100644 index 0000000..0ae6b52 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj @@ -0,0 +1,44 @@ + + + + Library + net5.0 + Support for reporting issues to the console for the Cake.Issues addin for Cake Build Automation System + Pascal Berger + Cake.Issues + Copyright © Pascal Berger + + + + full + true + AllEnabledByDefault + ..\Cake.Issues.Reporting.Console.ruleset + true + + + + bin\Debug\Cake.Issues.Reporting.Console.xml + DEBUG;TRACE + + + + bin\Release\Cake.Issues.Reporting.Console.xml + TRACE + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers + + + \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs new file mode 100644 index 0000000..e4636b2 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs @@ -0,0 +1,73 @@ +namespace Cake.Issues.Reporting.Console +{ + using Cake.Core; + using Cake.Core.Annotations; + using Cake.Issues.Reporting; + + /// + /// Contains functionality to report issues to the console. + /// + [CakeAliasCategory(IssuesAliasConstants.MainCakeAliasCategory)] + public static class ConsoleIssueReportFormatAliases + { + /// + /// Gets an instance of the console report format using default settings. + /// + /// The context. + /// Instance of a console report format. + /// + /// Report issues to console: + /// + /// + /// + /// + [CakeMethodAlias] + [CakeAliasCategory(ReportingAliasConstants.ReportingFormatCakeAliasCategory)] + public static IIssueReportFormat ConsoleIssueReportFormat( + this ICakeContext context) + { + context.NotNull(nameof(context)); + + return context.ConsoleIssueReportFormat(new ConsoleIssueReportFormatSettings()); + } + + /// + /// Gets an instance of the console report format using specified settings. + /// + /// The context. + /// Settings for generating the report. + /// Instance of a console report format. + /// + /// Report issues to console: + /// + /// + /// + /// + [CakeMethodAlias] + [CakeAliasCategory(ReportingAliasConstants.ReportingFormatCakeAliasCategory)] + public static IIssueReportFormat ConsoleIssueReportFormat( + this ICakeContext context, + ConsoleIssueReportFormatSettings settings) + { + context.NotNull(nameof(context)); + settings.NotNull(nameof(settings)); + + return new ConsoleIssueReportGenerator(context.Log, settings); + } + } +} diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs new file mode 100644 index 0000000..0f9adfb --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs @@ -0,0 +1,9 @@ +namespace Cake.Issues.Reporting.Console +{ + /// + /// Settings for . + /// + public class ConsoleIssueReportFormatSettings + { + } +} diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs new file mode 100644 index 0000000..435888a --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -0,0 +1,33 @@ +namespace Cake.Issues.Reporting.Console +{ + using System.Collections.Generic; + using Cake.Core.Diagnostics; + using Cake.Core.IO; + + /// + /// Generator for reporting issues to console. + /// + internal class ConsoleIssueReportGenerator : IssueReportFormat + { + private readonly ConsoleIssueReportFormatSettings consoleIssueReportFormatSettings; + + /// + /// Initializes a new instance of the class. + /// + /// The Cake log context. + /// Settings for reporting the issues. + public ConsoleIssueReportGenerator(ICakeLog log, ConsoleIssueReportFormatSettings settings) + : base(log) + { + settings.NotNull(nameof(settings)); + + this.consoleIssueReportFormatSettings = settings; + } + + /// + protected override FilePath InternalCreateReport(IEnumerable issues) + { + return null; + } + } +} \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console/Properties/SolutionInfo.cs b/src/Cake.Issues.Reporting.Console/Properties/SolutionInfo.cs new file mode 100644 index 0000000..02b427c --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/Properties/SolutionInfo.cs @@ -0,0 +1,21 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ed048c31-6180-4e2f-a786-207f489c37e8")] + +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("Cake.Issues.Reporting.Console.Tests")] diff --git a/tools/packages.config b/tools/packages.config new file mode 100644 index 0000000..2e2ecbd --- /dev/null +++ b/tools/packages.config @@ -0,0 +1,4 @@ + + + + From 9081e38b8ea54b4cea5a741edfa5e75851111f2a Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 23 Aug 2021 21:37:05 +0200 Subject: [PATCH 02/15] (GH-3) Initial version using Errata (#2) --- ...Cake.Issues.Reporting.Console.Tests.csproj | 6 ++ .../ConsoleIssueReportFixture.cs | 33 ++++++-- .../ConsoleIssueReportGeneratorTests.cs | 3 +- .../Testfiles/issues.json | 1 + src/Cake.Issues.Reporting.Console.sln | 3 +- .../ConsoleIssueReportGenerator.cs | 79 +++++++++++++++++++ .../FileSystemRepository.cs | 45 +++++++++++ .../IssueDiagnostic.cs | 43 ++++++++++ 8 files changed, 206 insertions(+), 7 deletions(-) create mode 100644 src/Cake.Issues.Reporting.Console.Tests/Testfiles/issues.json create mode 100644 src/Cake.Issues.Reporting.Console/FileSystemRepository.cs create mode 100644 src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs diff --git a/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj index b7051aa..e17cfb1 100644 --- a/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj +++ b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj @@ -15,6 +15,12 @@ ..\Cake.Issues.Reporting.Console.Tests.ruleset + + + + + + diff --git a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs index 5901f83..f53f654 100644 --- a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs +++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs @@ -2,14 +2,15 @@ { using System; using System.Collections.Generic; + using System.IO; using Cake.Core.Diagnostics; + using Cake.Core.IO; + using Cake.Issues.Serialization; using Cake.Testing; using Shouldly; internal class ConsoleIssueReportFixture { - public const string RepositoryRootPath = @"c:\Source\Cake.Issues.Reporting.Console"; - public ConsoleIssueReportFixture() { this.Log = new FakeLog { Verbosity = Verbosity.Normal }; @@ -20,13 +21,34 @@ public ConsoleIssueReportFixture() public ConsoleIssueReportFormatSettings ConsoleIssueReportFormatSettings { get; set; } - public string CreateReport(IEnumerable issues) + public string CreateReport(string fileResourceName, DirectoryPath repositoryRootPath) + { + fileResourceName.NotNullOrWhiteSpace(nameof(fileResourceName)); + + var resourceName = "Cake.Issues.Reporting.Console.Tests." + fileResourceName; + + using (var stream = this.GetType().Assembly.GetManifestResourceStream(resourceName)) + using (var reader = new StreamReader(stream)) + { + if (stream == null) + { + throw new ArgumentException( + $"Resource {resourceName} not found", + nameof(fileResourceName)); + } + + var issues = IssueDeserializationExtensions.DeserializeToIssues(reader.ReadToEnd()); + return this.CreateReport(issues, repositoryRootPath); + } + } + + public string CreateReport(IEnumerable issues, DirectoryPath repositoryRootPath) { var generator = new ConsoleIssueReportGenerator(this.Log, this.ConsoleIssueReportFormatSettings); var createIssueReportSettings = - new CreateIssueReportSettings(RepositoryRootPath, string.Empty); + new CreateIssueReportSettings(repositoryRootPath, string.Empty); generator.Initialize(createIssueReportSettings); generator.CreateReport(issues); @@ -50,7 +72,8 @@ public void TestReportCreation(Action settings .OfRule("Rule Foo") .WithPriority(IssuePriority.Warning) .Create(), - }); + }, + @"c:\Source\Cake.Issues.Reporting.Console"); // Then // Currently only checks if generation failed or not without checking actual output. diff --git a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs index db18786..3ccb6a3 100644 --- a/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs +++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs @@ -1,6 +1,5 @@ namespace Cake.Issues.Reporting.Console.Tests { - using Cake.Core.IO; using Cake.Issues.Testing; using Cake.Testing; using Xunit; @@ -42,8 +41,10 @@ public sealed class TheInternalCreateReportMethod public void Should_Generate_Report() { // Given + var fixture = new ConsoleIssueReportFixture(); // When + var logContents = fixture.CreateReport("Testfiles.issues.json", @"c:\Source\Cake.Issues.Reporting.Console"); // Then } diff --git a/src/Cake.Issues.Reporting.Console.Tests/Testfiles/issues.json b/src/Cake.Issues.Reporting.Console.Tests/Testfiles/issues.json new file mode 100644 index 0000000..6b50b61 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/Testfiles/issues.json @@ -0,0 +1 @@ +[{"Version":4,"Identifier":"The file header is missing or not located at the top of the file.","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":1,"EndLine":null,"Column":1,"EndColumn":null,"FileLink":null,"MessageText":"The file header is missing or not located at the top of the file.","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA1633","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1633.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive should appear within a namespace declaration","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":1,"EndLine":null,"Column":1,"EndColumn":null,"FileLink":null,"MessageText":"Using directive should appear within a namespace declaration","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA1200","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive should appear within a namespace declaration","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":2,"EndLine":null,"Column":1,"EndColumn":null,"FileLink":null,"MessageText":"Using directive should appear within a namespace declaration","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA1200","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive should appear within a namespace declaration","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":3,"EndLine":null,"Column":1,"EndColumn":null,"FileLink":null,"MessageText":"Using directive should appear within a namespace declaration","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA1200","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive should appear within a namespace declaration","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":4,"EndLine":null,"Column":1,"EndColumn":null,"FileLink":null,"MessageText":"Using directive should appear within a namespace declaration","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA1200","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive should appear within a namespace declaration","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":5,"EndLine":null,"Column":1,"EndColumn":null,"FileLink":null,"MessageText":"Using directive should appear within a namespace declaration","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA1200","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Member 'Foo' does not access instance data and can be marked as static","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":11,"EndLine":null,"Column":21,"EndColumn":null,"FileLink":null,"MessageText":"Member 'Foo' does not access instance data and can be marked as static","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"CA1822","RuleUrl":"https://www.google.com/search?q=\"CA1822:\"+site:docs.microsoft.com","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Member 'Bar' does not access instance data and can be marked as static","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":21,"EndLine":null,"Column":21,"EndColumn":null,"FileLink":null,"MessageText":"Member 'Bar' does not access instance data and can be marked as static","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"CA1822","RuleUrl":"https://www.google.com/search?q=\"CA1822:\"+site:docs.microsoft.com","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"XML comment analysis is disabled due to project configuration","ProjectFileRelativePath":"src/ClassLibrary1/ClassLibrary1.csproj","ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/CSC","Line":null,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"XML comment analysis is disabled due to project configuration","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"SA0001","RuleUrl":"https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md","ProviderType":"Cake.Issues.MsBuild.MsBuildIssuesProvider","ProviderName":"MSBuild","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive is not required by the code and can be safely removed","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":1,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Using directive is not required by the code and can be safely removed","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"RedundantUsingDirective","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantUsingDirective","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive is not required by the code and can be safely removed","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":2,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Using directive is not required by the code and can be safely removed","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"RedundantUsingDirective","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantUsingDirective","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive is not required by the code and can be safely removed","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":3,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Using directive is not required by the code and can be safely removed","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"RedundantUsingDirective","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantUsingDirective","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive is not required by the code and can be safely removed","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":4,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Using directive is not required by the code and can be safely removed","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"RedundantUsingDirective","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantUsingDirective","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Using directive is not required by the code and can be safely removed","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":5,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Using directive is not required by the code and can be safely removed","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"RedundantUsingDirective","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=RedundantUsingDirective","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Class 'Class1' is never used","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":9,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Class 'Class1' is never used","MessageMarkdown":null,"MessageHtml":null,"Priority":200,"PriorityName":"Suggestion","Rule":"UnusedType.Global","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=UnusedType.Global","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Method 'Foo' is never used","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":11,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Method 'Foo' is never used","MessageMarkdown":null,"MessageHtml":null,"Priority":200,"PriorityName":"Suggestion","Rule":"UnusedMember.Global","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=UnusedMember.Global","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Local variable 'foobar' is never used","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":17,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Local variable 'foobar' is never used","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"UnusedVariable","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=UnusedVariable","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Method 'Bar' is never used","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":21,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Method 'Bar' is never used","MessageMarkdown":null,"MessageHtml":null,"Priority":200,"PriorityName":"Suggestion","Rule":"UnusedMember.Global","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=UnusedMember.Global","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Local variable 'foobar' is never used","ProjectFileRelativePath":null,"ProjectName":"ClassLibrary1","AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":27,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Local variable 'foobar' is never used","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"UnusedVariable","RuleUrl":"https://www.jetbrains.com/resharperplatform/help?Keyword=UnusedVariable","ProviderType":"Cake.Issues.InspectCode.InspectCodeIssuesProvider","ProviderName":"InspectCode","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"src\\ClassLibrary1\\Class1.cs-76-src\\ClassLibrary1\\Class1.cs","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":12,"EndLine":19,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Possible duplicate detected (cost 76).\r\nThe following fragments were found that might be duplicates:\r\n\"src\\ClassLibrary1\\Class1.cs\" (Line 22 to 29)","MessageMarkdown":"Possible duplicate detected (cost 76).\r\nThe following fragments were found that might be duplicates:\r\n`src\\ClassLibrary1\\Class1.cs` (Line 22 to 29)","MessageHtml":"Possible duplicate detected (cost 76).
The following fragments were found that might be duplicates:
src\\ClassLibrary1\\Class1.cs (Line 22 to 29)","Priority":300,"PriorityName":"Warning","Rule":"dupFinder","RuleUrl":null,"ProviderType":"Cake.Issues.DupFinder.DupFinderIssuesProvider","ProviderName":"DupFinder","Run":null,"AdditionalInformation":{"cost":"76"}},{"Version":4,"Identifier":"src\\ClassLibrary1\\Class1.cs-76-src\\ClassLibrary1\\Class1.cs","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"src/ClassLibrary1/Class1.cs","Line":22,"EndLine":29,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Possible duplicate detected (cost 76).\r\nThe following fragments were found that might be duplicates:\r\n\"src\\ClassLibrary1\\Class1.cs\" (Line 12 to 19)","MessageMarkdown":"Possible duplicate detected (cost 76).\r\nThe following fragments were found that might be duplicates:\r\n`src\\ClassLibrary1\\Class1.cs` (Line 12 to 19)","MessageHtml":"Possible duplicate detected (cost 76).
The following fragments were found that might be duplicates:
src\\ClassLibrary1\\Class1.cs (Line 12 to 19)","Priority":300,"PriorityName":"Warning","Rule":"dupFinder","RuleUrl":null,"ProviderType":"Cake.Issues.DupFinder.DupFinderIssuesProvider","ProviderName":"DupFinder","Run":null,"AdditionalInformation":{"cost":"76"}},{"Version":4,"Identifier":"Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: \"# foo\"]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":1,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: \"# foo\"]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD022","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Trailing spaces [Expected: 0 or 2; Actual: 1]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":2,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Trailing spaces [Expected: 0 or 2; Actual: 1]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD009","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Line length [Expected: 80; Actual: 811]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":2,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Line length [Expected: 80; Actual: 811]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD013","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: \"# bar\"]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":4,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: \"# bar\"]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD022","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Multiple top-level headings in the same document [Context: \"# bar\"]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":4,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Multiple top-level headings in the same document [Context: \"# bar\"]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD025","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Fenced code blocks should be surrounded by blank lines [Context: \"```\"]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":5,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Fenced code blocks should be surrounded by blank lines [Context: \"```\"]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD031","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Fenced code blocks should have a language specified [Context: \"```\"]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":5,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Fenced code blocks should have a language specified [Context: \"```\"]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD040","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Line length [Expected: 80; Actual: 840]","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":6,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Line length [Expected: 80; Actual: 840]","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD013","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}},{"Version":4,"Identifier":"Files should end with a single newline character","ProjectFileRelativePath":null,"ProjectName":null,"AffectedFileRelativePath":"docs/index.md","Line":7,"EndLine":null,"Column":null,"EndColumn":null,"FileLink":null,"MessageText":"Files should end with a single newline character","MessageMarkdown":null,"MessageHtml":null,"Priority":300,"PriorityName":"Warning","Rule":"MD047","RuleUrl":"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md047","ProviderType":"Cake.Issues.Markdownlint.MarkdownlintIssuesProvider","ProviderName":"markdownlint","Run":null,"AdditionalInformation":{}}] \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console.sln b/src/Cake.Issues.Reporting.Console.sln index 7add30c..dd9bfc6 100644 --- a/src/Cake.Issues.Reporting.Console.sln +++ b/src/Cake.Issues.Reporting.Console.sln @@ -9,11 +9,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Issues.Reporting.Conso EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{44A982C3-1A02-497A-96B0-238D1F181BD5}" ProjectSection(SolutionItems) = preProject - ..\setup.cake = ..\setup.cake + ..\recipe.cake = ..\recipe.cake EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nuspec", "nuspec", "{8419B5EA-AC0C-41FD-AFB3-28FAE7B63CB1}" ProjectSection(SolutionItems) = preProject + ..\nuspec\nuget\Cake.Frosting.Issues.Reporting.Console.nuspec = ..\nuspec\nuget\Cake.Frosting.Issues.Reporting.Console.nuspec ..\nuspec\nuget\Cake.Issues.Reporting.Console.nuspec = ..\nuspec\nuget\Cake.Issues.Reporting.Console.nuspec EndProjectSection EndProject diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index 435888a..26e1ec4 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -1,8 +1,13 @@ namespace Cake.Issues.Reporting.Console { + using System; using System.Collections.Generic; + using System.IO; + using System.Linq; using Cake.Core.Diagnostics; using Cake.Core.IO; + using Errata; + using Spectre.Console; /// /// Generator for reporting issues to console. @@ -27,7 +32,81 @@ public ConsoleIssueReportGenerator(ICakeLog log, ConsoleIssueReportFormatSetting /// protected override FilePath InternalCreateReport(IEnumerable issues) { + // Filter to issues from existing files + issues = + issues + .Where(x => + x.AffectedFileRelativePath != null && + File.Exists(this.Settings.RepositoryRoot.CombineWithFilePath(x.AffectedFileRelativePath).FullPath)) + .ToList(); + + // Filter to issues with line and column information + // Errata currently doesn't support file or line level diagnostics. + // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/4 + // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/5 + issues = + issues + .Where(x => x.Line.HasValue && x.Column.HasValue) + .ToList(); + + var report = new Report(); + foreach (var issue in issues) + { + var color = issue.Priority switch + { + (int)IssuePriority.Error => Color.Red, + (int)IssuePriority.Warning => Color.Yellow, + (int)IssuePriority.Suggestion or (int)IssuePriority.Hint => Color.Blue, + _ => throw new Exception(), + }; + + (var location, var length) = this.GetLocation(issue); + var label = + new Label( + issue.AffectedFileRelativePath.FullPath, + location, + issue.Message(IssueCommentFormat.PlainText)) + .WithColor(color); + + if (length > 0) + { + label = label.WithLength(length); + } + + report.AddDiagnostic( + new IssueDiagnostic(issue) + .WithLabel(label)); + } + + report.Render( + AnsiConsole.Console, + new FileSystemRepository(this.Settings)); + return null; } + + /// + /// Returns the diagnostic location of an issue. + /// + /// Issue for which the location should be returned. + /// Location for the diagnostic. + private (Location location, int lenght) GetLocation(IIssue issue) + { + // Errata currently doesn't support file or line level diagnostics. + if (!issue.Line.HasValue || !issue.Column.HasValue) + { + return default; + } + + var location = new Location(issue.Line.Value, issue.Column.Value); + + int lenght = 0; + if (issue.EndColumn.HasValue) + { + lenght = issue.EndColumn.Value - issue.Column.Value; + } + + return (location, lenght); + } } } \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console/FileSystemRepository.cs b/src/Cake.Issues.Reporting.Console/FileSystemRepository.cs new file mode 100644 index 0000000..758a56b --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/FileSystemRepository.cs @@ -0,0 +1,45 @@ +namespace Cake.Issues.Reporting.Console +{ + using System; + using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; + using System.IO; + using Errata; + + /// + /// Repository to read the source files from the file system. + /// + internal sealed class FileSystemRepository : ISourceRepository + { + private readonly ICreateIssueReportSettings settings; + private readonly Dictionary cache = new (StringComparer.OrdinalIgnoreCase); + + /// + /// Initializes a new instance of the class. + /// + /// Settings for report creation. + public FileSystemRepository(ICreateIssueReportSettings settings) + { + this.settings = settings; + } + + /// + public bool TryGet(string id, [NotNullWhen(true)] out Source source) + { + if (!this.cache.TryGetValue(id, out source)) + { + var filePath = this.settings.RepositoryRoot.Combine(id).FullPath; + + if (!File.Exists(filePath)) + { + return false; + } + + source = new Source(id, File.ReadAllText(filePath)); + this.cache[id] = source; + } + + return true; + } + } +} diff --git a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs new file mode 100644 index 0000000..cbf699f --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs @@ -0,0 +1,43 @@ +namespace Cake.Issues.Reporting.Console +{ + using System; + using Errata; + using Spectre.Console; + + /// + /// Custom diagnostic for issues. + /// + internal sealed class IssueDiagnostic : Diagnostic + { + private readonly IIssue issue; + + /// + /// Initializes a new instance of the class. + /// + /// Issue which the diagnostic should describe. + public IssueDiagnostic(IIssue issue) + : base(issue.Rule) + { + this.issue = issue; + } + + /// + public override Color GetColor() + { + return this.issue.Priority switch + { + (int)IssuePriority.Error => Color.Red, + (int)IssuePriority.Warning => Color.Yellow, + (int)IssuePriority.Suggestion => Color.Blue, + (int)IssuePriority.Hint => Color.LightSkyBlue1, + _ => throw new Exception(), + }; + } + + /// + public override string GetPrefix() + { + return this.issue.PriorityName; + } + } +} \ No newline at end of file From 255ac3586279067f4df442497d788d4d2e3af935 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Tue, 24 Aug 2021 20:39:52 +0200 Subject: [PATCH 03/15] Add Errata license (#8) --- LICENSE | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/LICENSE b/LICENSE index 7c7a48c..ec77c1e 100644 --- a/LICENSE +++ b/LICENSE @@ -19,3 +19,33 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- + +The binary distribution of Cake.Issues.Reporting.Console on nuget.org incorporates material from the projects listed below: + +--- + +Errata + +MIT License + +Copyright (c) 2021 Patrik Svensson, Phil Scott, James Randall + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file From 7b08e5f8b0b78f171143055cf9c8c3ea2701d751 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Wed, 25 Aug 2021 21:29:17 +0200 Subject: [PATCH 04/15] Update Errata to 0.3.0 (#9) --- .../Cake.Issues.Reporting.Console.csproj | 2 +- .../ConsoleIssueReportGenerator.cs | 55 +--------------- .../IssueDiagnostic.cs | 63 ++++++++++++++++--- 3 files changed, 59 insertions(+), 61 deletions(-) diff --git a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj index 0ae6b52..3e12a59 100644 --- a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj +++ b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj @@ -31,7 +31,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index 26e1ec4..5d2e81e 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -49,64 +49,15 @@ protected override FilePath InternalCreateReport(IEnumerable issues) .Where(x => x.Line.HasValue && x.Column.HasValue) .ToList(); - var report = new Report(); + var report = new Report(new FileSystemRepository(this.Settings)); foreach (var issue in issues) { - var color = issue.Priority switch - { - (int)IssuePriority.Error => Color.Red, - (int)IssuePriority.Warning => Color.Yellow, - (int)IssuePriority.Suggestion or (int)IssuePriority.Hint => Color.Blue, - _ => throw new Exception(), - }; - - (var location, var length) = this.GetLocation(issue); - var label = - new Label( - issue.AffectedFileRelativePath.FullPath, - location, - issue.Message(IssueCommentFormat.PlainText)) - .WithColor(color); - - if (length > 0) - { - label = label.WithLength(length); - } - - report.AddDiagnostic( - new IssueDiagnostic(issue) - .WithLabel(label)); + report.AddDiagnostic(new IssueDiagnostic(issue)); } - report.Render( - AnsiConsole.Console, - new FileSystemRepository(this.Settings)); + report.Render(AnsiConsole.Console); return null; } - - /// - /// Returns the diagnostic location of an issue. - /// - /// Issue for which the location should be returned. - /// Location for the diagnostic. - private (Location location, int lenght) GetLocation(IIssue issue) - { - // Errata currently doesn't support file or line level diagnostics. - if (!issue.Line.HasValue || !issue.Column.HasValue) - { - return default; - } - - var location = new Location(issue.Line.Value, issue.Column.Value); - - int lenght = 0; - if (issue.EndColumn.HasValue) - { - lenght = issue.EndColumn.Value - issue.Column.Value; - } - - return (location, lenght); - } } } \ No newline at end of file diff --git a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs index cbf699f..8eb0c41 100644 --- a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs +++ b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs @@ -19,25 +19,72 @@ public IssueDiagnostic(IIssue issue) : base(issue.Rule) { this.issue = issue; + + this.Category = this.issue.PriorityName; + this.Color = + this.issue.Priority switch + { + (int)IssuePriority.Error => Color.Red, + (int)IssuePriority.Warning => Color.Yellow, + (int)IssuePriority.Suggestion => Color.Blue, + (int)IssuePriority.Hint => Color.LightSkyBlue1, + _ => throw new Exception(), + }; + + this.CreateLabels(); } - /// - public override Color GetColor() + /// + /// Creates labels for the issue. + /// + private void CreateLabels() { - return this.issue.Priority switch + var color = this.issue.Priority switch { (int)IssuePriority.Error => Color.Red, (int)IssuePriority.Warning => Color.Yellow, - (int)IssuePriority.Suggestion => Color.Blue, - (int)IssuePriority.Hint => Color.LightSkyBlue1, + (int)IssuePriority.Suggestion or (int)IssuePriority.Hint => Color.Blue, _ => throw new Exception(), }; + + (var location, var length) = this.GetLocation(this.issue); + var label = + new Label( + this.issue.AffectedFileRelativePath.FullPath, + location, + this.issue.Message(IssueCommentFormat.PlainText)) + .WithColor(color); + + if (length > 0) + { + label = label.WithLength(length); + } + + this.Labels.Add(label); } - /// - public override string GetPrefix() + /// + /// Returns the diagnostic location of an issue. + /// + /// Issue for which the location should be returned. + /// Location for the diagnostic. + private (Location location, int lenght) GetLocation(IIssue issue) { - return this.issue.PriorityName; + // Errata currently doesn't support file or line level diagnostics. + if (!issue.Line.HasValue || !issue.Column.HasValue) + { + return default; + } + + var location = new Location(issue.Line.Value, issue.Column.Value); + + int lenght = 0; + if (issue.EndColumn.HasValue) + { + lenght = issue.EndColumn.Value - issue.Column.Value; + } + + return (location, lenght); } } } \ No newline at end of file From 1c23a5a9b53d08cddc9c99da855e89cec6bd41f3 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 26 Aug 2021 21:33:04 +0200 Subject: [PATCH 05/15] Add Frosting integration tests (#7) --- azure-pipelines.yml | 26 ++++++++++- tests/frosting/net5.0/build.ps1 | 13 ++++++ tests/frosting/net5.0/build.sh | 11 +++++ tests/frosting/net5.0/build/.gitignore | 2 + tests/frosting/net5.0/build/Build.csproj | 13 ++++++ tests/frosting/net5.0/build/Program.cs | 46 +++++++++++++++++++ tests/frosting/net5.0/nuget.config | 14 ++++++ tests/frosting/net5.0/src/ClassLibrary1.sln | 22 +++++++++ .../net5.0/src/ClassLibrary1/Class1.cs | 31 +++++++++++++ .../src/ClassLibrary1/ClassLibrary1.csproj | 21 +++++++++ 10 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 tests/frosting/net5.0/build.ps1 create mode 100644 tests/frosting/net5.0/build.sh create mode 100644 tests/frosting/net5.0/build/.gitignore create mode 100644 tests/frosting/net5.0/build/Build.csproj create mode 100644 tests/frosting/net5.0/build/Program.cs create mode 100644 tests/frosting/net5.0/nuget.config create mode 100644 tests/frosting/net5.0/src/ClassLibrary1.sln create mode 100644 tests/frosting/net5.0/src/ClassLibrary1/Class1.cs create mode 100644 tests/frosting/net5.0/src/ClassLibrary1/ClassLibrary1.csproj diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e6f836f..e8e508c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,9 +10,31 @@ pr: - hotfix/* jobs: -- job: Windows +# Build +- job: Build pool: vmImage: 'windows-2019' steps: - powershell: ./build.ps1 - displayName: 'Cake Build' \ No newline at end of file + displayName: 'Build' + - publish: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet + artifact: NuGet Package + displayName: 'Publish NuGet packages as build artifact' +# Integration Tests Frosting Windows (.NET 5) +- job: Test_Frosting_Windows_Net5 + displayName: Integration Tests Frosting Windows (.NET 5) + dependsOn: Build + pool: + vmImage: 'windows-2019' + steps: + - download: current + artifact: NuGet Package + displayName: 'Download build artifact' + - task: CopyFiles@2 + inputs: + sourceFolder: $(Pipeline.Workspace)/NuGet Package + targetFolder: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet + displayName: 'Copy build artifact for test run' + - powershell: ./build.ps1 --verbosity=diagnostic + workingDirectory: ./tests/frosting/net5.0 + displayName: 'Run integration tests' diff --git a/tests/frosting/net5.0/build.ps1 b/tests/frosting/net5.0/build.ps1 new file mode 100644 index 0000000..478356d --- /dev/null +++ b/tests/frosting/net5.0/build.ps1 @@ -0,0 +1,13 @@ +$RECIPE_PACKAGE_PATH = "packages/cake.issues.reporting.console" +if (Test-Path $RECIPE_PACKAGE_PATH) +{ + Write-Host "Cleaning up cached version of $RECIPE_PACKAGE_PATH..." + Remove-Item $RECIPE_PACKAGE_PATH -Recurse; +} +else +{ + Write-Host "$RECIPE_PACKAGE_PATH not cached..." +} + +dotnet run --project build/Build.csproj -- $args +exit $LASTEXITCODE; \ No newline at end of file diff --git a/tests/frosting/net5.0/build.sh b/tests/frosting/net5.0/build.sh new file mode 100644 index 0000000..e0ec444 --- /dev/null +++ b/tests/frosting/net5.0/build.sh @@ -0,0 +1,11 @@ + +$RECIPE_PACKAGE_PATH = "packages/cake.issues.reporting.console" +if [ -d "$RECIPE_PACKAGE_PATH" ] +then + echo "Cleaning up cached version of $RECIPE_PACKAGE_PATH..." + rm -Rf $RECIPE_PACKAGE_PATH +else + echo "$RECIPE_PACKAGE_PATH not cached..." +fi + +dotnet run --project ./build/Build.csproj -- "$@" diff --git a/tests/frosting/net5.0/build/.gitignore b/tests/frosting/net5.0/build/.gitignore new file mode 100644 index 0000000..29cb0b5 --- /dev/null +++ b/tests/frosting/net5.0/build/.gitignore @@ -0,0 +1,2 @@ +### Cake ### +tools/* \ No newline at end of file diff --git a/tests/frosting/net5.0/build/Build.csproj b/tests/frosting/net5.0/build/Build.csproj new file mode 100644 index 0000000..565fec9 --- /dev/null +++ b/tests/frosting/net5.0/build/Build.csproj @@ -0,0 +1,13 @@ + + + Exe + net5.0 + $(MSBuildProjectDirectory) + + + + + + + + \ No newline at end of file diff --git a/tests/frosting/net5.0/build/Program.cs b/tests/frosting/net5.0/build/Program.cs new file mode 100644 index 0000000..eb8fc98 --- /dev/null +++ b/tests/frosting/net5.0/build/Program.cs @@ -0,0 +1,46 @@ +using System.Linq; +using Cake.Common.Diagnostics; +using Cake.Core; +using Cake.Frosting; +using Cake.Issues; +using Cake.Issues.Reporting; +using Cake.Issues.Reporting.Console; + +public static class Program +{ + public static int Main(string[] args) + { + return new CakeHost() + .UseContext() + .Run(args); + } +} + +public class BuildContext : FrostingContext +{ + public BuildContext(ICakeContext context) + : base(context) + { + } +} + +[TaskName("Print-Issues")] +public sealed class PrintIssuesTask : FrostingTask +{ + public override void Run(BuildContext context) + { + var issues = context.DeserializeIssuesFromJsonFile(@"../../../../src/Cake.Issues.Reporting.Console.Tests/Testfiles/issues.json"); + context.Information("Read {0} issues", issues.Count()); + context.CreateIssueReport( + issues, + context.ConsoleIssueReportFormat(), + @"../", + string.Empty); + } +} + +[TaskName("Default")] +[IsDependentOn(typeof(PrintIssuesTask))] +public class DefaultTask : FrostingTask +{ +} \ No newline at end of file diff --git a/tests/frosting/net5.0/nuget.config b/tests/frosting/net5.0/nuget.config new file mode 100644 index 0000000..663b555 --- /dev/null +++ b/tests/frosting/net5.0/nuget.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/frosting/net5.0/src/ClassLibrary1.sln b/tests/frosting/net5.0/src/ClassLibrary1.sln new file mode 100644 index 0000000..62df92e --- /dev/null +++ b/tests/frosting/net5.0/src/ClassLibrary1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{9B73BB5B-06A3-46F3-9068-E3607A8217B0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/frosting/net5.0/src/ClassLibrary1/Class1.cs b/tests/frosting/net5.0/src/ClassLibrary1/Class1.cs new file mode 100644 index 0000000..4ea0004 --- /dev/null +++ b/tests/frosting/net5.0/src/ClassLibrary1/Class1.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibrary1 +{ + public class Class1 + { + public void Foo() + { + var foo = "foo"; + var bar = "bar"; + if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) + { + var foobar = foo + bar; + } + } + + public void Bar() + { + var foo = "foo"; + var bar = "bar"; + if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) + { + var foobar = foo + bar; + } + } + } +} diff --git a/tests/frosting/net5.0/src/ClassLibrary1/ClassLibrary1.csproj b/tests/frosting/net5.0/src/ClassLibrary1/ClassLibrary1.csproj new file mode 100644 index 0000000..9ec4dd9 --- /dev/null +++ b/tests/frosting/net5.0/src/ClassLibrary1/ClassLibrary1.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + + + + + all + 3.0.0 + + + all + 1.1.118 + + + + + + + \ No newline at end of file From 0499abccc4ef55cbf02333721f55a021c4629367 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 26 Aug 2021 22:53:54 +0200 Subject: [PATCH 06/15] (GH-6) Possibility to group issues by rule (#10) --- .../ConsoleIssueReportFormatAliases.cs | 7 ++- .../ConsoleIssueReportFormatSettings.cs | 5 ++ .../ConsoleIssueReportGenerator.cs | 16 ++++-- .../IssueDiagnostic.cs | 52 ++++++++++++------- 4 files changed, 57 insertions(+), 23 deletions(-) diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs index e4636b2..b629081 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs @@ -44,11 +44,14 @@ public static IIssueReportFormat ConsoleIssueReportFormat( /// Settings for generating the report. /// Instance of a console report format. /// - /// Report issues to console: + /// Report issues to console grouped by rule: /// /// public class ConsoleIssueReportFormatSettings { + /// + /// Gets or sets a value indicating whether issues should be grouped by rule or if + /// for every issue a separate diagnostic should be created. + /// + public bool GroupByRule { get; set; } } } diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index 5d2e81e..bfb6f45 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -1,6 +1,5 @@ namespace Cake.Issues.Reporting.Console { - using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -50,9 +49,20 @@ protected override FilePath InternalCreateReport(IEnumerable issues) .ToList(); var report = new Report(new FileSystemRepository(this.Settings)); - foreach (var issue in issues) + + if (this.consoleIssueReportFormatSettings.GroupByRule) + { + foreach (var issueGroup in issues.GroupBy(x => x.Rule)) + { + report.AddDiagnostic(new IssueDiagnostic(issueGroup)); + } + } + else { - report.AddDiagnostic(new IssueDiagnostic(issue)); + foreach (var issue in issues) + { + report.AddDiagnostic(new IssueDiagnostic(issue)); + } } report.Render(AnsiConsole.Console); diff --git a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs index 8eb0c41..598545d 100644 --- a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs +++ b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs @@ -1,6 +1,8 @@ namespace Cake.Issues.Reporting.Console { using System; + using System.Collections.Generic; + using System.Linq; using Errata; using Spectre.Console; @@ -9,20 +11,31 @@ /// internal sealed class IssueDiagnostic : Diagnostic { - private readonly IIssue issue; + private readonly IEnumerable issues; /// /// Initializes a new instance of the class. /// /// Issue which the diagnostic should describe. public IssueDiagnostic(IIssue issue) - : base(issue.Rule) + : this(new List { issue }) { - this.issue = issue; + } + + /// + /// Initializes a new instance of the class. + /// + /// Issues which the diagnostic should describe. + public IssueDiagnostic(IEnumerable issues) + : base(issues.First().Rule) + { + this.issues = issues; - this.Category = this.issue.PriorityName; + var firstIssue = this.issues.First(); + + this.Category = firstIssue.PriorityName; this.Color = - this.issue.Priority switch + firstIssue.Priority switch { (int)IssuePriority.Error => Color.Red, (int)IssuePriority.Warning => Color.Yellow, @@ -39,7 +52,7 @@ public IssueDiagnostic(IIssue issue) /// private void CreateLabels() { - var color = this.issue.Priority switch + var color = this.issues.First().Priority switch { (int)IssuePriority.Error => Color.Red, (int)IssuePriority.Warning => Color.Yellow, @@ -47,20 +60,23 @@ private void CreateLabels() _ => throw new Exception(), }; - (var location, var length) = this.GetLocation(this.issue); - var label = - new Label( - this.issue.AffectedFileRelativePath.FullPath, - location, - this.issue.Message(IssueCommentFormat.PlainText)) - .WithColor(color); - - if (length > 0) + foreach (var issue in this.issues) { - label = label.WithLength(length); - } + (var location, var length) = this.GetLocation(issue); + var label = + new Label( + issue.AffectedFileRelativePath.FullPath, + location, + issue.Message(IssueCommentFormat.PlainText)) + .WithColor(color); - this.Labels.Add(label); + if (length > 0) + { + label = label.WithLength(length); + } + + this.Labels.Add(label); + } } /// From 39d6001f4d7dec152fe60791870b469ee32bee70 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 26 Aug 2021 23:04:19 +0200 Subject: [PATCH 07/15] (GH-11) Show rule URL (#13) --- src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs index 598545d..e69beb8 100644 --- a/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs +++ b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs @@ -44,6 +44,11 @@ public IssueDiagnostic(IEnumerable issues) _ => throw new Exception(), }; + if (firstIssue.RuleUrl != null) + { + this.Note = $"See {firstIssue.RuleUrl} for more information"; + } + this.CreateLabels(); } From 4b563a0629663259655c1c41badee90048bd36e0 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sat, 28 Aug 2021 13:33:15 +0200 Subject: [PATCH 08/15] Update Errata to 0.4 (#16) --- .../Cake.Issues.Reporting.Console.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj index 3e12a59..bac10dc 100644 --- a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj +++ b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj @@ -31,7 +31,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From a5e88724f40ab2a34f81d1d13cefa613284554dd Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 18:42:58 +0200 Subject: [PATCH 09/15] Update to Cake 1.2.0 (#17) --- .../Cake.Issues.Reporting.Console.Tests.csproj | 2 +- .../Cake.Issues.Reporting.Console.csproj | 2 +- tests/frosting/net5.0/build/Build.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj index e17cfb1..434c8c3 100644 --- a/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj +++ b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj @@ -38,7 +38,7 @@ 1.0.0 - 1.0.0 + 1.2.0 4.0.3 diff --git a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj index bac10dc..f8b81eb 100644 --- a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj +++ b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj @@ -28,7 +28,7 @@ - + diff --git a/tests/frosting/net5.0/build/Build.csproj b/tests/frosting/net5.0/build/Build.csproj index 565fec9..255e8f8 100644 --- a/tests/frosting/net5.0/build/Build.csproj +++ b/tests/frosting/net5.0/build/Build.csproj @@ -5,7 +5,7 @@ $(MSBuildProjectDirectory) - + From 87311ffba52b25c2fae83320533cc8d72ed737c7 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 19:17:59 +0200 Subject: [PATCH 10/15] Update Errata to 0.5.0 (#18) --- .../Cake.Issues.Reporting.Console.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj index f8b81eb..25d8f68 100644 --- a/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj +++ b/src/Cake.Issues.Reporting.Console/Cake.Issues.Reporting.Console.csproj @@ -31,7 +31,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 284eb330b843bfcdd88144bc31a9b6c709bfc1ef Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 19:24:40 +0200 Subject: [PATCH 11/15] (GH-14) Add summary report (#15) --- .../ConsoleIssueReportFormatSettings.cs | 12 +++ .../ConsoleIssueReportGenerator.cs | 87 +++++++++++++++++-- tests/frosting/net5.0/build/Program.cs | 7 +- 3 files changed, 100 insertions(+), 6 deletions(-) diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs index b7a0ded..2fbad5d 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs @@ -10,5 +10,17 @@ public class ConsoleIssueReportFormatSettings /// for every issue a separate diagnostic should be created. /// public bool GroupByRule { get; set; } + + /// + /// Gets or sets a value indicating whether a summary of issues by provider / run + /// should be shown. + /// + public bool ShowProviderSummary { get; set; } + + /// + /// Gets or sets a value indicating whether a summary of issues by provider / run + /// with the number of issues for each priority should be shown. + /// + public bool ShowPrioritySummary { get; set; } } } diff --git a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs index bfb6f45..4cc996d 100644 --- a/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -32,7 +32,7 @@ public ConsoleIssueReportGenerator(ICakeLog log, ConsoleIssueReportFormatSetting protected override FilePath InternalCreateReport(IEnumerable issues) { // Filter to issues from existing files - issues = + var diagnosticIssues = issues .Where(x => x.AffectedFileRelativePath != null && @@ -43,8 +43,8 @@ protected override FilePath InternalCreateReport(IEnumerable issues) // Errata currently doesn't support file or line level diagnostics. // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/4 // https://github.com/cake-contrib/Cake.Issues.Reporting.Console/issues/5 - issues = - issues + diagnosticIssues = + diagnosticIssues .Where(x => x.Line.HasValue && x.Column.HasValue) .ToList(); @@ -52,14 +52,14 @@ protected override FilePath InternalCreateReport(IEnumerable issues) if (this.consoleIssueReportFormatSettings.GroupByRule) { - foreach (var issueGroup in issues.GroupBy(x => x.Rule)) + foreach (var issueGroup in diagnosticIssues.GroupBy(x => x.Rule)) { report.AddDiagnostic(new IssueDiagnostic(issueGroup)); } } else { - foreach (var issue in issues) + foreach (var issue in diagnosticIssues) { report.AddDiagnostic(new IssueDiagnostic(issue)); } @@ -67,7 +67,84 @@ protected override FilePath InternalCreateReport(IEnumerable issues) report.Render(AnsiConsole.Console); + if (this.consoleIssueReportFormatSettings.ShowProviderSummary || this.consoleIssueReportFormatSettings.ShowPrioritySummary) + { + this.PrintSummary(issues); + } + return null; } + + /// + /// Prints the issues of issues. + /// + /// List of issues. + private void PrintSummary(IEnumerable issues) + { + AnsiConsole.WriteLine(); + AnsiConsole.WriteLine(); + var rule = new Rule("Summary").Centered(); + AnsiConsole.Render(rule); + AnsiConsole.WriteLine(); + + var providerChart = new BarChart(); + + var priorityTable = new Table + { + Border = TableBorder.Rounded, + Expand = true, + }; + priorityTable.AddColumn(new TableColumn("Issue Provider / Run").Centered()); + priorityTable.AddColumn(new TableColumn("Number Of Issues").Centered()); + + foreach (var providerGroup in issues.GroupBy(x => x.ProviderName)) + { + var issueProvider = providerGroup.Key; + + providerChart.AddItem(issueProvider, providerGroup.Count()); + + foreach (var runGroup in providerGroup.GroupBy(x => x.Run)) + { + if (!string.IsNullOrEmpty(runGroup.Key)) + { + issueProvider += " / {runGroup.Key}"; + } + + var errorCount = runGroup.Count(x => x.Priority.HasValue && x.Priority.Value == (int)IssuePriority.Error); + var warningCount = runGroup.Count(x => x.Priority.HasValue && x.Priority.Value == (int)IssuePriority.Warning); + var hintCount = runGroup.Count(x => x.Priority.HasValue && x.Priority.Value == (int)IssuePriority.Hint); + var suggestionCount = runGroup.Count(x => x.Priority.HasValue && x.Priority.Value == (int)IssuePriority.Suggestion); + var unknownCount = runGroup.Count(x => !x.Priority.HasValue || x.Priority.Value == (int)IssuePriority.Undefined); + + var chart = + new BarChart() + .AddItem("Errors", errorCount, Color.Red) + .AddItem("Warnings", warningCount, Color.Yellow) + .AddItem("Hint", hintCount, Color.LightSkyBlue1) + .AddItem("Suggestion", suggestionCount, Color.Green) + .AddItem("Unknown", unknownCount, Color.DarkSlateGray1); + + priorityTable.AddRow(new Markup(issueProvider), chart); + } + + priorityTable.AddEmptyRow(); + } + + if (this.consoleIssueReportFormatSettings.ShowProviderSummary) + { + AnsiConsole.Render(new Markup("[bold]Issues per provider & run[/]").Centered()); + AnsiConsole.WriteLine(); + AnsiConsole.WriteLine(); + AnsiConsole.Render(providerChart); + AnsiConsole.WriteLine(); + } + + if (this.consoleIssueReportFormatSettings.ShowProviderSummary) + { + AnsiConsole.Render(new Markup("[bold]Issues per priority[/]").Centered()); + AnsiConsole.WriteLine(); + AnsiConsole.Render(priorityTable); + } + } } } \ No newline at end of file diff --git a/tests/frosting/net5.0/build/Program.cs b/tests/frosting/net5.0/build/Program.cs index eb8fc98..8779e2d 100644 --- a/tests/frosting/net5.0/build/Program.cs +++ b/tests/frosting/net5.0/build/Program.cs @@ -33,7 +33,12 @@ public override void Run(BuildContext context) context.Information("Read {0} issues", issues.Count()); context.CreateIssueReport( issues, - context.ConsoleIssueReportFormat(), + context.ConsoleIssueReportFormat( + new ConsoleIssueReportFormatSettings + { + ShowProviderSummary = true, + ShowPrioritySummary = true + }), @"../", string.Empty); } From 75c2704a29142f35a0c43f32d06a01e33c50de7b Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 21:35:23 +0200 Subject: [PATCH 12/15] Add integration tests for script runner (#19) --- azure-pipelines.yml | 21 + tests/script-runner/.config/dotnet-tools.json | 12 + tests/script-runner/.gitignore | 379 ++++++++++++++++++ tests/script-runner/build.cake | 39 ++ tests/script-runner/nuget.config | 11 + tests/script-runner/src/ClassLibrary1.sln | 22 + .../script-runner/src/ClassLibrary1/Class1.cs | 31 ++ .../src/ClassLibrary1/ClassLibrary1.csproj | 21 + 8 files changed, 536 insertions(+) create mode 100644 tests/script-runner/.config/dotnet-tools.json create mode 100644 tests/script-runner/.gitignore create mode 100644 tests/script-runner/build.cake create mode 100644 tests/script-runner/nuget.config create mode 100644 tests/script-runner/src/ClassLibrary1.sln create mode 100644 tests/script-runner/src/ClassLibrary1/Class1.cs create mode 100644 tests/script-runner/src/ClassLibrary1/ClassLibrary1.csproj diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e8e508c..c526dfc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -38,3 +38,24 @@ jobs: - powershell: ./build.ps1 --verbosity=diagnostic workingDirectory: ./tests/frosting/net5.0 displayName: 'Run integration tests' +# Integration Tests Script Runner Windows (.NET tool) +- job: Test_Script_Runner_Windows_DotNetTool + displayName: Integration Tests Script Runner Windows (.NET tool) + dependsOn: Build + pool: + vmImage: 'windows-2019' + steps: + - download: current + artifact: NuGet Package + displayName: 'Download build artifact' + - task: CopyFiles@2 + inputs: + sourceFolder: $(Pipeline.Workspace)/NuGet Package + targetFolder: $(Build.SourcesDirectory)/BuildArtifacts/Packages/NuGet + displayName: 'Copy build artifact for test run' + - powershell: dotnet tool restore + workingDirectory: ./tests/script-runner/ + displayName: 'Restore .NET Core tool' + - powershell: dotnet cake + workingDirectory: ./tests/script-runner/ + displayName: 'Run integration tests' diff --git a/tests/script-runner/.config/dotnet-tools.json b/tests/script-runner/.config/dotnet-tools.json new file mode 100644 index 0000000..4123dc6 --- /dev/null +++ b/tests/script-runner/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "cake.tool": { + "version": "1.2.0", + "commands": [ + "dotnet-cake" + ] + } + } +} \ No newline at end of file diff --git a/tests/script-runner/.gitignore b/tests/script-runner/.gitignore new file mode 100644 index 0000000..e7c4962 --- /dev/null +++ b/tests/script-runner/.gitignore @@ -0,0 +1,379 @@ + +# Created by https://www.gitignore.io/api/cake,windows,visualstudio,visualstudiocode + +### Cake ### +tools/* +!tools/packages.config + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + + +# End of https://www.gitignore.io/api/cake,windows,visualstudio,visualstudiocode + + +# Project specific folders +BuildArtifacts diff --git a/tests/script-runner/build.cake b/tests/script-runner/build.cake new file mode 100644 index 0000000..220d8bb --- /dev/null +++ b/tests/script-runner/build.cake @@ -0,0 +1,39 @@ +#addin "Cake.Issues&prerelease" +#addin "Cake.Issues.Reporting&prerelease" +#addin "Cake.Issues.Reporting.Console&prerelease" + +////////////////////////////////////////////////// +// ARGUMENTS +////////////////////////////////////////////////// + +var target = Argument("target", "Default"); + +////////////////////////////////////////////////// +// TARGETS +////////////////////////////////////////////////// + +Task("Print-Issues") + .Does(() => +{ + var issues = DeserializeIssuesFromJsonFile(@"../../src/Cake.Issues.Reporting.Console.Tests/Testfiles/issues.json"); + Information("Read {0} issues", issues.Count()); + CreateIssueReport( + issues, + ConsoleIssueReportFormat( + new ConsoleIssueReportFormatSettings + { + ShowProviderSummary = true, + ShowPrioritySummary = true + }), + @".", + string.Empty); +}); + +Task("Default") + .IsDependentOn("Print-Issues"); + +////////////////////////////////////////////////// +// EXECUTION +////////////////////////////////////////////////// + +RunTarget(target); \ No newline at end of file diff --git a/tests/script-runner/nuget.config b/tests/script-runner/nuget.config new file mode 100644 index 0000000..a202f0a --- /dev/null +++ b/tests/script-runner/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/script-runner/src/ClassLibrary1.sln b/tests/script-runner/src/ClassLibrary1.sln new file mode 100644 index 0000000..62df92e --- /dev/null +++ b/tests/script-runner/src/ClassLibrary1.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{9B73BB5B-06A3-46F3-9068-E3607A8217B0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tests/script-runner/src/ClassLibrary1/Class1.cs b/tests/script-runner/src/ClassLibrary1/Class1.cs new file mode 100644 index 0000000..4ea0004 --- /dev/null +++ b/tests/script-runner/src/ClassLibrary1/Class1.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ClassLibrary1 +{ + public class Class1 + { + public void Foo() + { + var foo = "foo"; + var bar = "bar"; + if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) + { + var foobar = foo + bar; + } + } + + public void Bar() + { + var foo = "foo"; + var bar = "bar"; + if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) + { + var foobar = foo + bar; + } + } + } +} diff --git a/tests/script-runner/src/ClassLibrary1/ClassLibrary1.csproj b/tests/script-runner/src/ClassLibrary1/ClassLibrary1.csproj new file mode 100644 index 0000000..9ec4dd9 --- /dev/null +++ b/tests/script-runner/src/ClassLibrary1/ClassLibrary1.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + + + + + all + 3.0.0 + + + all + 1.1.118 + + + + + + + \ No newline at end of file From a8fd487fce7553a812283f62eff06fdfaaf069a3 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 21:40:49 +0200 Subject: [PATCH 13/15] Add documentation (#20) --- docs/examples.md | 51 ++++++++++++++++++++++++++++++++++++++++++++ docs/features.md | 14 ++++++++++++ docs/index.cshtml | 12 +++++++++++ docs/requirements.md | 9 ++++++++ 4 files changed, 86 insertions(+) create mode 100644 docs/examples.md create mode 100644 docs/features.md create mode 100644 docs/index.cshtml create mode 100644 docs/requirements.md diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..4c2e2a9 --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,51 @@ +--- +Order: 30 +Title: Examples +Description: Examples for using the Cake.Issues.Reporting.Console addin. +--- +The following example will print issues logged as warnings by MsBuild to the console. + +:::{.alert .alert-warning} +Please note that you always should pin addins and tools to a specific version to make sure your builds are deterministic and +won't break due to updates to one of the packages. + +See [pinning addin versions](https://cakebuild.net/docs/tutorials/pinning-cake-version#pinning-addin-version) for details. +::: + +```csharp +#tool "nuget:?package=MSBuild.Extension.Pack" +#addin "Cake.Issues" +#addin "Cake.Issues.MsBuild" +#addin "Cake.Issues.Reporting" +#addin "Cake.Issues.Reporting.Console" + +Task("Create-IssueReport").Does(() => +{ + var repoRootFolder = new DirectoryPath(@"c:\repo"); + + // Build MySolution.sln solution in the repository root folder and log issues + // using XmlFileLogger from MSBuild Extension Pack. + FilePath msBuildLogFile = @"c:\build\msbuild.log"; + var settings = new MsBuildSettings() + .WithLogger( + Context.Tools.Resolve("MSBuild.ExtensionPack.Loggers.dll").FullPath, + "XmlFileLogger", + string.Format( + "logfile=\"{0}\";verbosity=Detailed;encoding=UTF-8", + msBuildLogFile) + ); + MSBuild(repoRootFolder.CombineWithFilePath("MySolution.sln"), settings); + + // Create SARIF report. + CreateIssueReport( + new List + { + MsBuildIssuesFromFilePath( + msBuildLogFile, + MsBuildXmlFileLoggerFormat) + }, + ConsoleIssueReportFormat(), + repoRootFolder, + string.Empty); +}); +``` \ No newline at end of file diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 0000000..77b9ec1 --- /dev/null +++ b/docs/features.md @@ -0,0 +1,14 @@ +--- +Order: 20 +Title: Features +Description: Features of the Cake.Issues.Reporting.Console addin. +--- +The [Cake.Issues.Reporting.Console addin] provides the following features: + +* Prints issues containing line and column information. +* Group issues by rule +* Reports: + * Number of issues by provider + * Number of issues by priority for every provider and run + +[Cake.Issues.Reporting.Console addin]: https://www.nuget.org/packages/Cake.Issues.Reporting.Console diff --git a/docs/index.cshtml b/docs/index.cshtml new file mode 100644 index 0000000..5003c90 --- /dev/null +++ b/docs/index.cshtml @@ -0,0 +1,12 @@ +--- +Title: Console +Description: Report format to print issues to the console. +--- +

@Html.Raw(Model.String(DocsKeys.Description))

+ +

+ Support for printing issues to the console is implemented in the + Cake.Issues.Reporting.Console addin. +

+ +@Html.Partial("_ChildPages") \ No newline at end of file diff --git a/docs/requirements.md b/docs/requirements.md new file mode 100644 index 0000000..469d4c6 --- /dev/null +++ b/docs/requirements.md @@ -0,0 +1,9 @@ +--- +Order: 10 +Title: Requirements +Description: Requirements for the Cake.Issues.Reporting.Console addin. +--- +The requirements for using the [Cake.Issues.Reporting.Console addin] are listed in the [release notes] for any specific version. + +[Cake.Issues.Reporting.Console addin]: https://www.nuget.org/packages/Cake.Issues.Reporting.Console +[release notes]: release-notes \ No newline at end of file From 95f77bbeddb58ff88a62fd9f3e6c933d1596c645 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 21:45:31 +0200 Subject: [PATCH 14/15] Update release notes link --- nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec | 2 +- nuspec/nuget/Cake.Issues.Reporting.Console.nuspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec index 843bf82..2caa4fc 100644 --- a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec @@ -28,7 +28,7 @@ The addin requires .NET 5.0. Copyright © Pascal Berger cake cake-addin cake-issues cake-reportformat issues reporting console - https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/1.0.0 + https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 diff --git a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec index 260bbcf..ff0e726 100644 --- a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec @@ -28,7 +28,7 @@ The addin requires .NET 5.0. Copyright © Pascal Berger cake cake-addin cake-issues cake-reportformat issues reporting console - https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/1.0.0 + https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 From 95b6646515b9c9e5374df40df07517d87c74180b Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Sun, 29 Aug 2021 21:47:42 +0200 Subject: [PATCH 15/15] Mention requirement for Cake 1.2.0 --- nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec | 4 ++-- nuspec/nuget/Cake.Issues.Reporting.Console.nuspec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec index 2caa4fc..1273b60 100644 --- a/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Frosting.Issues.Reporting.Console.nuspec @@ -19,7 +19,7 @@ NOTE: This is the version of the addin compatible with Cake Frosting. For addin compatible with Cake Script Runners see Cake.Issues.Reporting.Console. -The addin requires .NET 5.0. +The addin requires Cake Frosting 1.2.0 or higher running on .NET 5.0 or higher. MIT https://cakeissues.net @@ -31,7 +31,7 @@ The addin requires .NET 5.0. https://github.com/cake-contrib/Cake.Issues.Reporting.Console/releases/tag/0.1.0 - + diff --git a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec index ff0e726..66bcc7e 100644 --- a/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec +++ b/nuspec/nuget/Cake.Issues.Reporting.Console.nuspec @@ -19,7 +19,7 @@ NOTE: This is the version of the addin compatible with Cake .NET Tool. For addin compatible with Cake Frosting see Cake.Frosting.Issues.Reporting.Console. -The addin requires .NET 5.0. +The addin requires Cake .NET Tool 1.2.0 or higher running on .NET 5.0 or higher. MIT https://cakeissues.net