Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Framework Updates #389

Merged
merged 7 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/workflows/SonarCloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ jobs:
# (PRs from forks can't access secrets other than secrets.GITHUB_TOKEN for security reasons)
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
version: '3.3.2'
versionFile: '3.3.2'
version: '3.4.0'
versionFile: '3.4.0'
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
echo "Packing Version: ${{ env.version }}, File Version: ${{ env.versionFile }}"
dotnet pack ./src/SmartFormat.Deploy.sln /verbosity:minimal --configuration release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:PackageOutputPath=${{ github.workspace }}/artifacts /p:Version=${{ env.version }} /p:FileVersion=${{ env.versionFile }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Packages_${{ env.version }}
path: ${{ github.workspace }}/artifacts/
6 changes: 2 additions & 4 deletions PkgReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ Custom source or formatter extensions can be added easily using simple interface
* Custom formatting and source extensions are easy to integrate
* Comprehensive documentation: current Wiki, complete xmldoc

### Supported Frameworks
* .Net Framework 4.6.1 and later
* .Net Standard 2.0
* .Net Standard 2.1 and later for best optimizations
### Note
Use .Net Standard 2.1 and later for best optimizations

[![Paypal-Donations](https://img.shields.io/badge/Donate-PayPal-important.svg?style=flat-square)](https://www.paypal.com/donate?hosted_button_id=KSC3LRAR26AHN)
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ environment:
- job_name: windows
appveyor_build_worker_image: Visual Studio 2022
- job_name: linux
appveyor_build_worker_image: Ubuntu
appveyor_build_worker_image: Ubuntu2204
matrix:
fast_finish: true

Expand All @@ -23,7 +23,7 @@ for:
- ps: dotnet restore SmartFormat.sln --verbosity quiet
- ps: dotnet add .\SmartFormat.Tests\SmartFormat.Tests.csproj package AltCover
- ps: |
$version = "3.3.2"
$version = "3.4.0"
$versionFile = $version + "." + ${env:APPVEYOR_BUILD_NUMBER}

if ($env:APPVEYOR_PULL_REQUEST_NUMBER) {
Expand All @@ -38,7 +38,7 @@ for:
}
test_script:
- cmd: nuget install Appveyor.TestLogger
- cmd: dotnet test --framework net6.0 --test-adapter-path:. --logger:Appveyor SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCover=true /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|SmartFormat.ZString|NUnit3.TestAdapter" /p:AltCoverLineCover="true"
- cmd: dotnet test --framework net6.0 SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|NUnit3.TestAdapter" /p:AltCoverAttributeFilter="ExcludeFromCodeCoverage" /p:AltCoverLineCover="true"
- cmd: nuget install codecov -excludeversion
- cmd: .\Codecov\Tools\win7-x86\codecov.exe -f ".\SmartFormat.Tests\coverage.net6.0.xml" -n net6.0win
artifacts:
Expand All @@ -64,5 +64,5 @@ for:
- dotnet add ./SmartFormat.Tests/SmartFormat.Tests.csproj package AltCover
- dotnet build SmartFormat.sln /verbosity:minimal /t:rebuild /p:configuration=release /nowarn:CS1591,CS0618
test_script:
- dotnet test --no-build --framework net6.0 SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCover=true /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|SmartFormat.ZString|NUnit3.TestAdapter" /p:AltCoverLineCover="true"
- dotnet test --no-build --framework net6.0 SmartFormat.sln /p:configuration=release /p:AltCover=true /p:AltCoverXmlReport="coverage.xml" /p:AltCoverStrongNameKey="..\SmartFormat\SmartFormat.snk" /p:AltCoverAssemblyExcludeFilter="SmartFormat.Tests|NUnit3.TestAdapter" /p:AltCoverAttributeFilter="ExcludeFromCodeCoverage" /p:AltCoverLineCover="true"
- bash <(curl -s https://codecov.io/bash) -f ./SmartFormat.Tests/coverage.net6.0.xml -n net6.0linux
4 changes: 2 additions & 2 deletions src/Demo/Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFrameworks>net6.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>SmartFormat.Demo.ico</ApplicationIcon>
<LangVersion>8.0</LangVersion>
<NoWarn>$(NoWarn);1591,1573</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
23 changes: 11 additions & 12 deletions src/Demo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using System;
using System.Windows.Forms;

namespace SmartFormat.Demo
namespace SmartFormat.Demo;

internal static class Program
{
static class Program
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SmartFormatDemo());
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SmartFormatDemo());
}
}
40 changes: 20 additions & 20 deletions src/Demo/Sample Extensions/ArgumentValidator.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
using System;
#nullable enable
using System;
using System.Collections;
#nullable enable
namespace SmartFormat.Demo.Sample_Extensions

namespace Demo.Sample_Extensions;

public class ArgumentValidator
{
public class ArgumentValidator
public static void CheckForNullReference(object? argument, string argumentName)
{
public static void CheckForNullReference(object? argument, string argumentName)
{
if (argument != null) return;
throw new ArgumentNullException(argumentName);
}
if (argument != null) return;
throw new ArgumentNullException(argumentName);
}

public static void CheckForZeroValue(int argument, string argumentName)
{
if (argument != 0) return;
throw new ArgumentOutOfRangeException(argumentName, argument, argumentName + " cannot be zero");
}
public static void CheckForZeroValue(int argument, string argumentName)
{
if (argument != 0) return;
throw new ArgumentOutOfRangeException(argumentName, argument, argumentName + " cannot be zero");
}

public static void CheckForEmpty(IEnumerable argument, string argumentName)
{
var enumerator = argument.GetEnumerator();
if (enumerator.MoveNext()) return;
throw new ArgumentException(argumentName + " cannot be empty", argumentName);
}
public static void CheckForEmpty(IEnumerable argument, string argumentName)
{
var enumerator = argument.GetEnumerator();
if (enumerator.MoveNext()) return;
throw new ArgumentException(argumentName + " cannot be empty", argumentName);
}
}
Loading