Skip to content

Commit

Permalink
chore: update .editorconfig and csproj files
Browse files Browse the repository at this point in the history
- Update .editorconfig to adjust naming styles and severity levels
- Suppress warning CS1591 in Artesian.SDK.Tests.csproj
- Remove and modify metadata in Artesian.SDK.csproj
- Change several methods and enums from public to internal
- Add XML documentation comments in Artesian.SDK.Dto.DerivedCfg
- Change JsonCreationConverter and JsonPolymorphicConverter to internal
- Remove unused using directives from various files
- Use 'new' keyword to hide base class methods in query files
- Delete ark-dark.png from project folder (duplicate of root folder)
- Add new solution items and Directory.Build.props file
- Set LangVersion to latest and TreatWarningsAsErrors to true
- Add package references and custom target in Directory.Build.props
  • Loading branch information
AndreaCuneo committed Dec 24, 2024
1 parent 2957f94 commit 1a85292
Show file tree
Hide file tree
Showing 25 changed files with 178 additions and 110 deletions.
36 changes: 21 additions & 15 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -190,43 +190,43 @@ dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.private_method.required_modifiers =

dotnet_naming_symbols.private_property.applicable_kinds = property
dotnet_naming_symbols.private_property.applicable_accessibilities = private
dotnet_naming_symbols.private_property.required_modifiers =
dotnet_naming_symbols.private_property.required_modifiers =

dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.begins_with__.required_prefix = _
dotnet_naming_style.begins_with__.required_suffix =
dotnet_naming_style.begins_with__.word_separator =
dotnet_naming_style.begins_with__.required_suffix =
dotnet_naming_style.begins_with__.word_separator =
dotnet_naming_style.begins_with__.capitalization = camel_case
csharp_style_namespace_declarations = block_scoped:warning
dotnet_diagnostic.CA1825.severity = warning
Expand All @@ -239,11 +239,12 @@ dotnet_diagnostic.CA1507.severity = warning
dotnet_diagnostic.CA2016.severity = warning
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_null_check_over_type_check = true:warning
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_local_over_anonymous_function = true:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
dotnet_code_quality.ca1051.exclude_structs = true
csharp_style_prefer_primary_constructors = true:suggestion

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
Expand All @@ -268,7 +269,7 @@ dotnet_diagnostic.CA1061.severity = warning
dotnet_diagnostic.CA1067.severity = warning
dotnet_diagnostic.CA1068.severity = error
dotnet_diagnostic.CA1069.severity = error
dotnet_diagnostic.CA1304.severity = suggestion
dotnet_diagnostic.CA1304.severity = warning
dotnet_diagnostic.CA1305.severity = suggestion
dotnet_diagnostic.CA1310.severity = suggestion
dotnet_diagnostic.CA1821.severity = error
Expand All @@ -293,6 +294,11 @@ dotnet_diagnostic.CA2215.severity = warning
dotnet_diagnostic.CA2219.severity = warning
dotnet_diagnostic.CA2242.severity = warning
dotnet_diagnostic.CA2245.severity = error
dotnet_diagnostic.CA1510.severity = suggestion
dotnet_diagnostic.CA1050.severity = warning
dotnet_diagnostic.CA1862.severity = warning
dotnet_diagnostic.CA1850.severity = warning
dotnet_diagnostic.IDE0005.severity = warning
dotnet_style_readonly_field = true:suggestion
dotnet_diagnostic.CA1063.severity = error
dotnet_diagnostic.CA2213.severity = warning
Expand Down
1 change: 1 addition & 0 deletions Artesian/Artesian.SDK.Tests/Artesian.SDK.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
33 changes: 2 additions & 31 deletions Artesian/Artesian.SDK/Artesian.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,18 @@

<PropertyGroup>
<TargetFrameworks>net8.0;netstandard2.0;netstandard2.1;net462</TargetFrameworks>
<ApplicationIcon />
<Win32Resource />
<OutputType>Library</OutputType>
<StartupObject />
<PackageProjectUrl>https://github.com/ARKlab/Artesian.SDK</PackageProjectUrl>
<Copyright>Copyright (C) 2024 ARK Energy LTD</Copyright>
<Company>ARK Labs</Company>
<Authors>ARK Labs</Authors>
<PackageIcon>ark-dark.png</PackageIcon>
<RepositoryUrl>https://github.com/ARKlab/Artesian.SDK</RepositoryUrl>

<Description>Artesian SDK library</Description>
<PackageTags>Ark;c#;Visual Studio;Framework;Arkive;Artesian;</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>

<PackageReleaseNotes>
Breaking: remove support for .NET6 (EOL) in favor of .NET8
</PackageReleaseNotes>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>

<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Platforms>AnyCPU;x64;x86</Platforms>
<IsPackable>true</IsPackable>
</PropertyGroup>

<PropertyGroup>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<ItemGroup>
<None Include="ark-dark.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>

<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions Artesian/Artesian.SDK/Common/ArtesianUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ArtesianUtils
/// Mapping the Date Period based on Granularity
/// </summary>
/// <param name="granularity">Granularity</param>
public static DatePeriod MapDatePeriod(Granularity granularity)
internal static DatePeriod MapDatePeriod(Granularity granularity)
{
DatePeriod selectedPeriod = DatePeriod.Day;

Expand Down Expand Up @@ -51,7 +51,7 @@ public static DatePeriod MapDatePeriod(Granularity granularity)
/// Mapping the Time Period based on Granularity
/// </summary>
/// <param name="granularity">Granularity</param>
public static TimePeriod MapTimePeriod(Granularity granularity)
internal static TimePeriod MapTimePeriod(Granularity granularity)
{
if (!granularity.IsTimeGranularity())
throw new ArgumentException("not a time granularity", nameof(granularity));
Expand Down
2 changes: 1 addition & 1 deletion Artesian/Artesian.SDK/Common/DatePeriod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// DatePeriod enums
/// </summary>
public enum DatePeriod : byte
internal enum DatePeriod : byte
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
Day = 2,
Expand Down
2 changes: 1 addition & 1 deletion Artesian/Artesian.SDK/Common/TimePeriod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// TimePeriod enums
/// </summary>
public enum TimePeriod : byte
internal enum TimePeriod : byte
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
Hour = 2,
Expand Down
5 changes: 3 additions & 2 deletions Artesian/Artesian.SDK/Dto/DerivedCfg/DerivedCfgBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

namespace Artesian.SDK.Dto.DerivedCfg
{
/// <summary>
/// Base class for Derived Configuration.
/// </summary>
[MessagePackObject]
[Union(0, typeof(DerivedCfgMuv))]
[Union(1, typeof(DerivedCfgCoalesce))]
Expand All @@ -26,7 +29,5 @@ public abstract record DerivedCfgBase
/// </summary>
[IgnoreMember]
public abstract DerivedAlgorithm DerivedAlgorithm { get; }


}
}
5 changes: 4 additions & 1 deletion Artesian/Artesian.SDK/Dto/DerivedCfg/DerivedCfgCoalesce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

namespace Artesian.SDK.Dto.DerivedCfg
{
/// <summary>
/// Represents a derived configuration that uses the Coalesce algorithm.
/// </summary>
[MessagePackObject]
public record DerivedCfgCoalesce : DerivedCfgWithReferencedIds
{
/// <summary>
/// The Derived Alrghorithm
/// The Derived Algorithm
/// </summary>
[IgnoreMember]
public override DerivedAlgorithm DerivedAlgorithm => DerivedAlgorithm.Coalesce;
Expand Down
5 changes: 4 additions & 1 deletion Artesian/Artesian.SDK/Dto/DerivedCfg/DerivedCfgMuv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

namespace Artesian.SDK.Dto.DerivedCfg
{
/// <summary>
/// Represents the configuration for the MostUpdatedVersion derived algorithm.
/// </summary>
[MessagePackObject]
public record DerivedCfgMuv : DerivedCfgBase
{
/// <summary>
/// The Derived Alrghorithm
/// The Derived Algorithm
/// </summary>
[IgnoreMember]
public override DerivedAlgorithm DerivedAlgorithm => DerivedAlgorithm.MUV;
Expand Down
9 changes: 5 additions & 4 deletions Artesian/Artesian.SDK/Dto/DerivedCfg/DerivedCfgSum.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System.Linq;

using Artesian.SDK.Dto.DerivedCfg.Enums;
using Artesian.SDK.Dto.DerivedCfg.Enums;

using MessagePack;

namespace Artesian.SDK.Dto.DerivedCfg
{
/// <summary>
/// Represents a derived configuration that uses the Sum algorithm.
/// </summary>
[MessagePackObject]
public record DerivedCfgSum : DerivedCfgWithReferencedIds
{
/// <summary>
/// The Derived Alrghorithm
/// The Derived Algorithm
/// </summary>
[IgnoreMember]
public override DerivedAlgorithm DerivedAlgorithm => DerivedAlgorithm.Sum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using MessagePack;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Artesian.SDK.Dto.DerivedCfg
{
/// <summary>
/// Represents a configuration with referenced market data IDs for derived data.
/// </summary>
[MessagePackObject]
public abstract record DerivedCfgWithReferencedIds : DerivedCfgBase
{
/// <summary>
/// The referenced market data IDs: order MAY be relevant depending on the selected algorithm.
/// </summary>
[Key("OrderedReferencedMarketDataIds")]
public int[] OrderedReferencedMarketDataIds { get; set; }
}
Expand Down
12 changes: 12 additions & 0 deletions Artesian/Artesian.SDK/Dto/DerivedCfg/Enums/DerivedAlgorithm.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
namespace Artesian.SDK.Dto.DerivedCfg.Enums
{
/// <summary>
/// Enumeration for specifying the derived algorithm.
/// </summary>
public enum DerivedAlgorithm
{
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
/// <summary>
/// Most-Updated-Version algorithm.
/// </summary>
MUV,
/// <summary>
/// Summation algorithm.
/// </summary>
Sum,
/// <summary>
/// Coalesce algorithm.
/// </summary>
Coalesce
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,8 @@ protected override Type GetType(DerivedAlgorithm discriminatorValue)
}
}

public abstract class JsonCreationConverter<T> : JsonConverter
internal abstract class JsonCreationConverter<T> : JsonConverter
{
/// <summary>
/// Create an instance of objectType, based properties in the JSON object
/// </summary>
/// <param name="objectType">type of object expected</param>
/// <param name="jObject">
/// contents of JSON object that will be deserialized
/// </param>
/// <returns></returns>
protected abstract T Create(Type objectType, JObject jObject);

public override bool CanConvert(Type objectType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Artesian.SDK.Dto.DerivedCfg.Serialize
{
public abstract class JsonPolymorphicConverter<TBase, TDiscriminatorEnum> : JsonConverter<TBase> where TDiscriminatorEnum : struct, Enum
internal abstract class JsonPolymorphicConverter<TBase, TDiscriminatorEnum> : JsonConverter<TBase> where TDiscriminatorEnum : struct, Enum
{
private readonly string _discriminatorPropertyName;

Expand Down
1 change: 0 additions & 1 deletion Artesian/Artesian.SDK/Factory/ActualTimeSerie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using NodaTime;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

Expand Down
1 change: 0 additions & 1 deletion Artesian/Artesian.SDK/Factory/BidAsk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;

Expand Down
1 change: 0 additions & 1 deletion Artesian/Artesian.SDK/Factory/MarketAssessment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;

Expand Down
Loading

0 comments on commit 1a85292

Please sign in to comment.