Skip to content

Commit

Permalink
Release 2.1.0 (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt authored Dec 11, 2023
1 parent d8b46c4 commit 49c342e
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 22 deletions.
13 changes: 12 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ dotnet_diagnostic.RCS1162.severity = suggestion
dotnet_diagnostic.RCS1188.severity = suggestion
dotnet_diagnostic.RCS1189.severity = suggestion
dotnet_diagnostic.RCS1207.severity = suggestion
dotnet_diagnostic.RCS1228.severity = suggestion
dotnet_diagnostic.RCS1237.severity = none
dotnet_diagnostic.RCS1244.severity = suggestion
dotnet_diagnostic.RCS1248.severity = suggestion
Expand All @@ -148,6 +149,7 @@ dotnet_diagnostic.RCS1253.severity = suggestion
dotnet_diagnostic.RCS1254.severity = suggestion
dotnet_diagnostic.RCS1255.severity = none
dotnet_diagnostic.RCS1260.severity = suggestion
dotnet_diagnostic.RCS9001.severity = suggestion

dotnet_diagnostic.IDE0007.severity = none
dotnet_diagnostic.IDE0007WithoutSuggestion.severity = none
Expand All @@ -171,7 +173,7 @@ dotnet_diagnostic.IDE0026.severity = none
dotnet_diagnostic.IDE0026WithoutSuggestion.severity = none
dotnet_diagnostic.IDE0027.severity = none
dotnet_diagnostic.IDE0027WithoutSuggestion.severity = none
dotnet_diagnostic.IDE0028.severity = suggestion
dotnet_diagnostic.IDE0028.severity = none # Collection initialization can be simplified
dotnet_diagnostic.IDE0029.severity = suggestion
dotnet_diagnostic.IDE0031.severity = suggestion
dotnet_diagnostic.IDE0033.severity = suggestion
Expand All @@ -196,6 +198,11 @@ dotnet_diagnostic.IDE0079.severity = none
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.IDE0220.severity = none
dotnet_diagnostic.IDE0270.severity = silent
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor
dotnet_diagnostic.IDE0300.severity = none # Use collection expression
dotnet_diagnostic.IDE0301.severity = none # ImmutableArray<object>.Empty -> []
dotnet_diagnostic.IDE0303.severity = none # ImmutableArray.Create(x) -> [x]
dotnet_diagnostic.IDE0305.severity = none # x.ToArray() -> [.. x]
dotnet_diagnostic.IDE1005.severity = suggestion
dotnet_diagnostic.IDE1006.severity = suggestion

Expand All @@ -205,4 +212,8 @@ dotnet_diagnostic.RS1026.severity = none

dotnet_diagnostic.CA1806.severity = none
dotnet_diagnostic.CA1826.severity = none
dotnet_diagnostic.CA1860.severity = none
dotnet_diagnostic.CA1861.severity = none
dotnet_diagnostic.CA2231.severity = none

dotnet_diagnostic.SYSLIB1045.severity = silent # Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
working-directory: src/Snippetica.CodeGeneration.SnippetGenerator
- run: dotnet build --no-restore
working-directory: src/Snippetica.CodeGeneration.SnippetGenerator
- run: "src/Snippetica.CodeGeneration.SnippetGenerator/bin/Release/net6.0/Snippetica.CodeGeneration.SnippetGenerator src src/Snippetica.CodeGeneration.Metadata/Data"
- run: "src/Snippetica.CodeGeneration.SnippetGenerator/bin/Release/net8.0/Snippetica.CodeGeneration.SnippetGenerator src src/Snippetica.CodeGeneration.Metadata/Data"
name: "Generate snippets"
working-directory: "."
- uses: microsoft/[email protected]
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
working-directory: src/Snippetica.CodeGeneration.SnippetGenerator
- run: dotnet build --no-restore
working-directory: src/Snippetica.CodeGeneration.SnippetGenerator
- run: "./src/Snippetica.CodeGeneration.SnippetGenerator/bin/Release/net6.0/Snippetica.CodeGeneration.SnippetGenerator src src/Snippetica.CodeGeneration.Metadata/Data"
- run: "./src/Snippetica.CodeGeneration.SnippetGenerator/bin/Release/net8.0/Snippetica.CodeGeneration.SnippetGenerator src src/Snippetica.CodeGeneration.Metadata/Data"
working-directory: "."
name: "Generate snippets"
- run: >
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [2.1.0] - 2023-12-11

### Fixed

- Fix snippets for abstract method ([PR](https://github.com/josefpihrt/snippetica/pull/82))
Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10.0</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>12.0</LangVersion>
<Authors>Josef Pihrt</Authors>
<Copyright>Copyright (c) 2016-2023 Josef Pihrt</Copyright>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
Expand Down
7 changes: 2 additions & 5 deletions src/Snippetica.CodeGeneration.Common/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ public static class EnumerableExtensions
{
public static bool CountExceeds<TSource>(this IEnumerable<TSource> collection, int value)
{
if (collection is null)
throw new ArgumentNullException(nameof(collection));

if (value < 0)
throw new ArgumentOutOfRangeException(nameof(value));
ArgumentNullException.ThrowIfNull(collection);
ArgumentOutOfRangeException.ThrowIfNegative(value);

if (value == 0)
return false;
Expand Down
3 changes: 1 addition & 2 deletions src/Snippetica.CodeGeneration.Common/IO/IOUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ public static void SaveSnippet(Snippet snippet, bool onlyIfChanged = true)

public static void SaveSnippet(Snippet snippet, string filePath, bool onlyIfChanged = true)
{
if (snippet is null)
throw new ArgumentNullException(nameof(snippet));
ArgumentNullException.ThrowIfNull(snippet);

SaveOptions settings = CreateSaveSettings();

Expand Down
16 changes: 9 additions & 7 deletions src/Snippetica.CodeGeneration.Metadata/SnippeticaMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ namespace Snippetica.CodeGeneration;

public class SnippeticaMetadata
{
private static readonly JsonSerializerOptions _serializerOptions = new()
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters = { new JsonStringEnumConverter() },
ReadCommentHandling = JsonCommentHandling.Skip,
};

public SnippetDirectory[] Directories { get; init; }

public ShortcutInfo[] Shortcuts { get; init; }
Expand All @@ -22,13 +30,7 @@ public static SnippeticaMetadata Load(string filePath, string sourcePath)
{
JsonSnippeticaMetadata jsonMetadata = JsonSerializer.Deserialize<JsonSnippeticaMetadata>(
File.ReadAllText(filePath),
new JsonSerializerOptions()
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
Converters = { new JsonStringEnumConverter() },
ReadCommentHandling = JsonCommentHandling.Skip,
});
_serializerOptions);

var metadata = new SnippeticaMetadata()
{
Expand Down
3 changes: 1 addition & 2 deletions src/Snippetica.CodeGeneration.SnippetGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ private static void SaveChangedSnippets(SnippetDirectory[] directories)

private static IEnumerable<(string, List<Snippet>)> FindDuplicateShortcuts(IEnumerable<Snippet> snippets)
{
if (snippets is null)
throw new ArgumentNullException(nameof(snippets));
ArgumentNullException.ThrowIfNull(snippets);

return FindDuplicateShortcuts();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [2.1.0] - 2023-12-11

### Fixed

- Fix snippets for abstract method ([PR](https://github.com/josefpihrt/snippetica/pull/82))

## [2.0.2] - 2023-11-05

## [2.0.1] - 2023-11-05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [2.1.0] - 2023-12-11

### Fixed

- Fix snippets for abstract method ([PR](https://github.com/josefpihrt/snippetica/pull/82))

## [2.0.2] - 2023-11-05

## [2.0.1] - 2023-11-05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [2.1.0] - 2023-12-11

### Fixed

- Fix snippets for abstract method ([PR](https://github.com/josefpihrt/snippetica/pull/82))

## [2.0.2] - 2023-11-05

## [2.0.1] - 2023-11-05
Expand Down
2 changes: 1 addition & 1 deletion tools/generate_docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ dotnet build "../src/Snippetica.CodeGeneration.DocumentationGenerator/Documentat

if(!$?) { Read-Host; Exit }

& "../src/Snippetica.CodeGeneration.DocumentationGenerator/bin/Release/net6.0/Snippetica.CodeGeneration.DocumentationGenerator" "../src" "build" "../src/Snippetica.CodeGeneration.Metadata/data"
& "../src/Snippetica.CodeGeneration.DocumentationGenerator/bin/Release/net8.0/Snippetica.CodeGeneration.DocumentationGenerator" "../src" "build" "../src/Snippetica.CodeGeneration.Metadata/data"

0 comments on commit 49c342e

Please sign in to comment.