Skip to content

Commit

Permalink
Some more cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Nov 17, 2023
1 parent 4cdbd38 commit 2330fa6
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 15 deletions.
6 changes: 6 additions & 0 deletions cli/Squidex.CLI/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ dotnet_diagnostic.CA2016.severity = none
# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = none

# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = none

# IDE0063: Use simple 'using' statement
dotnet_diagnostic.IDE0063.severity = none

Expand Down Expand Up @@ -117,6 +120,9 @@ dotnet_diagnostic.RECS0154.severity = none
# SA1009: Closing parenthesis should be spaced correctly
dotnet_diagnostic.SA1009.severity = none

# SA1010: Opening square brackets should be spaced correctly
dotnet_diagnostic.SA1010.severity = none

# SA1011: Closing square brackets should be spaced correctly
dotnet_diagnostic.SA1011.severity = none

Expand Down
12 changes: 6 additions & 6 deletions cli/Squidex.CLI/Squidex.CLI.Tests/TestDataGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void Should_generate_numbers_from_allowed_values()
CreateManyScalars(
new NumberFieldPropertiesDto
{
AllowedValues = new List<double> { 13, 27, 42 }
AllowedValues = [13, 27, 42]
});

Assert.Equal(3, values.Count);
Expand Down Expand Up @@ -264,7 +264,7 @@ public void Should_generate_tags_with_allowed_values()
CreateManyStringTags(
new TagsFieldPropertiesDto
{
AllowedValues = new List<string> { "foo", "bar" }
AllowedValues = ["foo", "bar"]
});

var distinct = values.SelectMany(x => x).Distinct().ToList();
Expand Down Expand Up @@ -347,7 +347,7 @@ public void Should_generate_string_with_allowed_values()
CreateManyScalars(
new StringFieldPropertiesDto
{
AllowedValues = new List<string> { "foo", "bar" }
AllowedValues = ["foo", "bar"]
});

Assert.Equal(2, values.Count);
Expand Down Expand Up @@ -526,15 +526,15 @@ private static HashSet<List<string>> CreateManyStringTags(FieldPropertiesDto fie
{
var schema = new SchemaDto
{
Fields = new List<FieldDto>
{
Fields =
[
new FieldDto
{
Name = "field",
Properties = field,
Partitioning = "invariant"
}
}
]
};

var sut = new TestDataGenerator(schema, null!);
Expand Down
6 changes: 6 additions & 0 deletions csharp/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ dotnet_diagnostic.CA2016.severity = none
# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = none

# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = none

# IDE0063: Use simple 'using' statement
dotnet_diagnostic.IDE0063.severity = none

Expand Down Expand Up @@ -117,6 +120,9 @@ dotnet_diagnostic.RECS0154.severity = none
# SA1009: Closing parenthesis should be spaced correctly
dotnet_diagnostic.SA1009.severity = none

# SA1010: Opening square brackets should be spaced correctly
dotnet_diagnostic.SA1010.severity = none

# SA1011: Closing square brackets should be spaced correctly
dotnet_diagnostic.SA1011.severity = none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed record AssetFolderNode
/// </summary>
public static readonly string RootId = Guid.Empty.ToString();

private readonly Dictionary<string, AssetFolderNode> children = new Dictionary<string, AssetFolderNode>();
private readonly Dictionary<string, AssetFolderNode> children = [];

/// <summary>
/// Gets the children of this folder.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace Squidex.ClientLibrary;
/// </summary>
public sealed class AssetFolderTree
{
private static readonly char[] TrimChars = { '/', '\\', ' ', '.' };
private static readonly char[] SplitChars = { '/', '\\' };
private static readonly char[] TrimChars = ['/', '\\', ' ', '.'];
private static readonly char[] SplitChars = ['/', '\\'];
private static readonly string RootId = Guid.Empty.ToString();
private readonly Dictionary<string, AssetFolderNode> nodes = new Dictionary<string, AssetFolderNode>();
private readonly Dictionary<string, AssetFolderNode> nodes = [];
private readonly IAssetsClient assetsClient;
private readonly AssetFolderNode rootNode = new AssetFolderNode(RootId, string.Empty, string.Empty);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class BulkUpdate
/// <summary>
/// The contents to update or insert.
/// </summary>
public List<BulkUpdateJob> Jobs { get; set; } = new List<BulkUpdateJob>();
public List<BulkUpdateJob> Jobs { get; set; } = [];

/// <summary>
/// True to automatically publish the content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Squidex.ClientLibrary.Configuration;

internal sealed class Cache<TKey, TValue> where TKey : notnull
{
private readonly Dictionary<TKey, CacheEntry> items = new Dictionary<TKey, CacheEntry>();
private readonly Dictionary<TKey, CacheEntry> items = [];

private sealed class CacheEntry
{
Expand Down Expand Up @@ -81,7 +81,7 @@ private void Cleanup()
{
if (kvp.Value.Expires <= now)
{
keysToRemove ??= new List<TKey>();
keysToRemove ??= [];
keysToRemove.Add(kvp.Key);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Squidex.ClientLibrary;
/// <value>
/// The content items.
/// </value>
public List<TEntity> Items { get; } = new List<TEntity>();
public List<TEntity> Items { get; } = [];

/// <summary>
/// Gets or sets the total number of content items in the App.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Squidex.ClientLibrary;

internal sealed class ProgressHandlerAdapter : IProgressHandler
{
private static readonly Dictionary<string, IEnumerable<string>> NullHeaders = new Dictionary<string, IEnumerable<string>>();
private static readonly Dictionary<string, IEnumerable<string>> NullHeaders = [];
private readonly IAssetProgressHandler inner;
private readonly AssetsClient client;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ protected internal async Task<T> RequestJsonAsync<T>(HttpMethod method, string p
}
}

#pragma warning disable CA1822 // Mark members as static
protected internal HttpRequestMessage BuildRequest(HttpMethod method, string path, HttpContent? content, QueryContext? context)
#pragma warning restore CA1822 // Mark members as static
{
var request = new HttpRequestMessage(method, path);

Expand Down

0 comments on commit 2330fa6

Please sign in to comment.