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/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 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..c526dfc --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,61 @@ +trigger: +- develop +- main +- release/* +- hotfix/* + +pr: +- develop +- release/* +- hotfix/* + +jobs: +# Build +- job: Build + pool: + vmImage: 'windows-2019' + steps: + - powershell: ./build.ps1 + 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' +# 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/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/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 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..1273b60 --- /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 Cake Frosting 1.2.0 or higher running on .NET 5.0 or higher. + + 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/0.1.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..66bcc7e --- /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 Cake .NET Tool 1.2.0 or higher running on .NET 5.0 or higher. + + 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/0.1.0 + + + + + + + + + \ No newline at end of file diff --git a/nuspec/nuget/icon.png b/nuspec/nuget/icon.png new file mode 100644 index 0000000..84c2a82 Binary files /dev/null and b/nuspec/nuget/icon.png differ diff --git a/recipe.cake b/recipe.cake new file mode 100644 index 0000000..319dcb7 --- /dev/null +++ b/recipe.cake @@ -0,0 +1,23 @@ +#load nuget:?package=Cake.Recipe&version=2.2.1 + +Environment.SetVariableNames(); + +BuildParameters.SetParameters( + context: Context, + buildSystem: BuildSystem, + sourceDirectoryPath: "./src", + title: "Cake.Issues.Reporting.Console", + repositoryOwner: "cake-contrib", + repositoryName: "Cake.Issues.Reporting.Console", + appVeyorAccountName: "cakecontrib"); + +BuildParameters.PrintParameters(Context); + +ToolSettings.SetToolSettings( + context: Context, + dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Reporting.Console.Tests/*.cs" }, + testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[Cake.Issues]* -[Cake.Issues.Testing]* -[Cake.Issues.Reporting]* -[Shouldly]* -[Spectre.Console]* -[Wcwidth]* -[Errata]* -[DiffEngine]* -[EmptyFiles]*", + testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", + testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs"); + +Build.RunDotNetCore(); diff --git a/src/Cake.Issues.Reporting.Console.Tests.ruleset b/src/Cake.Issues.Reporting.Console.Tests.ruleset new file mode 100644 index 0000000..91097b5 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests.ruleset @@ -0,0 +1,10 @@ + + + + + + + + + + \ 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..434c8c3 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/Cake.Issues.Reporting.Console.Tests.csproj @@ -0,0 +1,61 @@ + + + + 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.2.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..f53f654 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportFixture.cs @@ -0,0 +1,83 @@ +namespace Cake.Issues.Reporting.Console.Tests +{ + 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 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(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); + 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(), + }, + @"c:\Source\Cake.Issues.Reporting.Console"); + + // 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..3ccb6a3 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.Tests/ConsoleIssueReportGeneratorTests.cs @@ -0,0 +1,53 @@ +namespace Cake.Issues.Reporting.Console.Tests +{ + 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 + 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/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.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.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..dd9bfc6 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console.sln @@ -0,0 +1,45 @@ + +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 + ..\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 +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..25d8f68 --- /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..b629081 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatAliases.cs @@ -0,0 +1,76 @@ +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 grouped by rule: + /// + /// + /// + /// + [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..2fbad5d --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportFormatSettings.cs @@ -0,0 +1,26 @@ +namespace Cake.Issues.Reporting.Console +{ + /// + /// Settings for . + /// + 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; } + + /// + /// 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 new file mode 100644 index 0000000..4cc996d --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/ConsoleIssueReportGenerator.cs @@ -0,0 +1,150 @@ +namespace Cake.Issues.Reporting.Console +{ + 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. + /// + 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) + { + // Filter to issues from existing files + var diagnosticIssues = + 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 + diagnosticIssues = + diagnosticIssues + .Where(x => x.Line.HasValue && x.Column.HasValue) + .ToList(); + + var report = new Report(new FileSystemRepository(this.Settings)); + + if (this.consoleIssueReportFormatSettings.GroupByRule) + { + foreach (var issueGroup in diagnosticIssues.GroupBy(x => x.Rule)) + { + report.AddDiagnostic(new IssueDiagnostic(issueGroup)); + } + } + else + { + foreach (var issue in diagnosticIssues) + { + report.AddDiagnostic(new IssueDiagnostic(issue)); + } + } + + 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/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..e69beb8 --- /dev/null +++ b/src/Cake.Issues.Reporting.Console/IssueDiagnostic.cs @@ -0,0 +1,111 @@ +namespace Cake.Issues.Reporting.Console +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Errata; + using Spectre.Console; + + /// + /// Custom diagnostic for issues. + /// + internal sealed class IssueDiagnostic : Diagnostic + { + private readonly IEnumerable issues; + + /// + /// Initializes a new instance of the class. + /// + /// Issue which the diagnostic should describe. + public IssueDiagnostic(IIssue issue) + : this(new List { 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; + + var firstIssue = this.issues.First(); + + this.Category = firstIssue.PriorityName; + this.Color = + firstIssue.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(), + }; + + if (firstIssue.RuleUrl != null) + { + this.Note = $"See {firstIssue.RuleUrl} for more information"; + } + + this.CreateLabels(); + } + + /// + /// Creates labels for the issue. + /// + private void CreateLabels() + { + var color = this.issues.First().Priority switch + { + (int)IssuePriority.Error => Color.Red, + (int)IssuePriority.Warning => Color.Yellow, + (int)IssuePriority.Suggestion or (int)IssuePriority.Hint => Color.Blue, + _ => throw new Exception(), + }; + + foreach (var issue in this.issues) + { + (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); + } + + this.Labels.Add(label); + } + } + + /// + /// 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/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/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..255e8f8 --- /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..8779e2d --- /dev/null +++ b/tests/frosting/net5.0/build/Program.cs @@ -0,0 +1,51 @@ +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( + new ConsoleIssueReportFormatSettings + { + ShowProviderSummary = true, + ShowPrioritySummary = true + }), + @"../", + 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 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 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 @@ + + + +