Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -404,4 +404,7 @@ _packages/
.zf/extensions/
*.sbom.*
.endjin/
BenchmarkDotNet.Artifacts/
BenchmarkDotNet.Artifacts/

# Microsoft.Testing.Platform diagnostic logs written to the repo root by the ZeroFailed test task
/*.diag
11 changes: 11 additions & 0 deletions .zf/config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ This example demonstrates a software build process using the 'ZeroFailed.Build.D
to provide the features needed when building a .NET solutions.
#>

# Reproducible builds: pin SOURCE_DATE_EPOCH to the HEAD commit's timestamp, so the copyright year in
# Endjin.Conventions.props (and anything else honouring the convention) derives from the commit being
# built rather than from the clock, and rebuilding a commit yields identical bytes across a year
# boundary. A value already present in the environment wins; outside a git checkout the clock is used.
if (-not $env:SOURCE_DATE_EPOCH) {
$commitTimestamp = & git log -1 --format=%ct 2>$null
if ($LASTEXITCODE -eq 0 -and $commitTimestamp) {
$env:SOURCE_DATE_EPOCH = "$commitTimestamp".Trim()
}
}

$zerofailedExtensions = @(
@{
# References the extension from its GitHub repository. If not already installed, use latest version from 'main' will be downloaded.
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ For any licensing questions, please email [licens&#

## Project Sponsor

This project is sponsored by [endjin](https://endjin.com), a UK based Technology Consultancy which specializes in Data & Analytics, AI & Cloud Native App Dev, and is a [.NET Foundation Corporate Sponsor](https://dotnetfoundation.org/membership/corporate-sponsorship).
This project is sponsored by [endjin](https://endjin.com), a UK based Technology Consultancy which specializes in Data & Analytics, AI & Cloud Native App Dev.

> We help small teams achieve big things.

We produce two free weekly newsletters:
We produce three free weekly newsletters:

- [Azure Weekly](https://azureweekly.info) for all things about the Microsoft Azure Platform
- [Power BI Weekly](https://powerbiweekly.info) for all things Power BI, Microsoft Fabric, and Azure Synapse Analytics
- [Power BI Weekly](https://powerbiweekly.info) for all things Power BI
- [Fabric Weekly](https://fabricweekly.info) for all things Microsoft Fabric

Keep up with everything that's going on at endjin via our [blog](https://endjin.com/blog), follow us on [Twitter](https://twitter.com/endjin), [YouTube](https://www.youtube.com/c/endjin) or [LinkedIn](https://www.linkedin.com/company/endjin).

Expand Down
267 changes: 162 additions & 105 deletions Solutions/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,110 +1,167 @@
# Note: this file was added to your solution as a result of one or more projects using the Endjin.RecommendedPractices.Build.Common NuGet package.
# You can edit this file (e.g., to remove these comments), and it will not be updated - the package just checks for its presence, and copies
# this file. If you don't want this file (but you want to use the NuGet package that puts it here), add this setting to all projects
# using Endjin.RecommendedPractices.Build.Common:
# <EndjinDisableCodeAnalysis>true</EndjinDisableCodeAnalysis>
# and then delete this file. That setting will prevent the package from recreating this file.

# Code style rules for enforcing the endjin house style
# See: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

# XML project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# XML config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# C# files
[*.{cs,csx}]
indent_size = 4
insert_final_newline = false
root = true

# Core editorconfig formatting - indentation

# use soft tabs (spaces) for indentation
# All files
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = false
trim_trailing_whitespace = true

# Formatting - indentation options

csharp_indent_case_contents = true
csharp_indent_switch_labels = true

# Formatting - new line options

csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_open_brace = object_collection, object_collection_array_initalizers, accessors, lambdas, control_blocks, methods, properties, types

# Formatting - spacing options

csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false

# Formatting - wrapping options

csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true


# Style - expression bodied member options

csharp_style_expression_bodied_accessors = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_properties = false:none

# Style - expression level options

csharp_style_inlined_variable_declaration = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Style - implicit and explicit types

csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = false:warning

# Style - language keyword and framework type options

dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion

# Style - qualification options

dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_qualification_for_event = true:suggestion

# Style - using directives and namespace declarations
csharp_using_directive_placement = inside_namespace:warning
# C# files
[*.cs]

# C# 12 Language features
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_primary_constructors = false:suggestion
csharp_style_prefer_top_level_statements = true:silent

# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion

# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:warning
csharp_style_prefer_null_check_over_type_check = true:suggestion

# Modifier preferences
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion

# Expression preferences
csharp_prefer_simple_using_statement = true:warning
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = true:warning
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent

# Expression-bodied members
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion

# Collection expressions (C# 12)
dotnet_style_prefer_collection_expression = true:suggestion

# Code style rules
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:warning

# Field preferences
dotnet_style_readonly_field = true:warning

# Parameter preferences
dotnet_code_quality_unused_parameters = all:warning

# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none

# Code style for 'this.' qualification
dotnet_style_qualification_for_field = true:silent
dotnet_style_qualification_for_property = true:silent
dotnet_style_qualification_for_method = true:silent
dotnet_style_qualification_for_event = true:silent

# Blank line preferences
csharp_blank_lines_around_region = 1
csharp_blank_lines_inside_region = 1
csharp_blank_lines_between_using_groups = 1

# Using preferences
csharp_using_directive_placement = outside_namespace:warning
csharp_prefer_simple_using_statement = true:warning
dotnet_style_namespace_match_folder = true:suggestion
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# IDE0005: Remove unnecessary using directives
dotnet_diagnostic.IDE0005.severity = warning

# Naming conventions
dotnet_naming_rule.interface_should_be_prefixed_with_i.severity = warning
dotnet_naming_rule.interface_should_be_prefixed_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_prefixed_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
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, private_protected

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

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, private_protected

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

dotnet_naming_style.pascal_case.capitalization = pascal_case

# Source code files
[src/**/*.cs]
# CA1848: Use LoggerMessage delegates for performance
dotnet_diagnostic.CA1848.severity = none
# CA1031: Do not catch general exception types
dotnet_diagnostic.CA1031.severity = none
# CA1515: Make internal since this is an application
dotnet_diagnostic.CA1515.severity = none
# CA1050: Declare types in namespaces - top-level programs don't need this
dotnet_diagnostic.CA1050.severity = none
# CA2007: ConfigureAwait not needed in applications
dotnet_diagnostic.CA2007.severity = none
# CA1034: Nested types are ok for settings
dotnet_diagnostic.CA1034.severity = none

# Test files
[**/*Tests.cs]
# CA1707: Allow underscores in test method names
dotnet_diagnostic.CA1707.severity = none
# CA1303: Do not pass literals as localized parameters
dotnet_diagnostic.CA1303.severity = none
# CA1515: Consider making public types internal
dotnet_diagnostic.CA1515.severity = none
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = none

# JSON files
[*.json]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2

# Code analyzer rules (formerly in StyleCop.ruleset)
# SA1025 makes it impossible to write decent-looking switch expressions because it
# doesn't allow multiple whitespace characters in a row. There seems to be no way to
# disable this rule just inside switch expressions, so we reluctantly live without it.
dotnet_diagnostic.SA1025.severity = None
# StyleCop's insistence that constructors' summaries must always start with exactly
# the same boilerplate text is not deeply helpful. Saying "Creates a Foo"
# is in most cases better than the "Initializes a new instance of the Foo type"
# that this rule insists on.
dotnet_diagnostic.SA1642.severity = None

# CLS Compliance - not relevant for most of what we work on.
dotnet_diagnostic.CA1014.severity = None

# Standard exception constructors - not helpful when the exception absolutely needs certain information
dotnet_diagnostic.CA1032.severity = None
dotnet_diagnostic.RCS1194.severity = None

# Localize string constants - apps that want localization can turn this back on
dotnet_diagnostic.CA1303.severity = None
# XML files
[*.{xml,csproj,props,targets}]
indent_size = 2
4 changes: 1 addition & 3 deletions Solutions/Ais.Net.Models.Benchmarks/ConversionBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace Ais.Net.Models.Benchmarks;

using Ais.Net.Models;
using Ais.Net.Models.Abstractions;

using BenchmarkDotNet.Attributes;

namespace Ais.Net.Models.Benchmarks;
/// <summary>
/// Measures the pure numeric/enum helpers on the decode path. These are expected to be
/// branch-free-ish, sub-nanosecond, and allocation-free; the benchmark exists to prove that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
namespace Ais.Net.Models.Benchmarks;

using Ais.Net.Models;
using Ais.Net.Models.Abstractions;

using BenchmarkDotNet.Attributes;

namespace Ais.Net.Models.Benchmarks;
/// <summary>
/// Measures the cost of materialising a model record for a decoded message. Records are
/// reference types, so each message is at least one heap allocation (plus a nested
Expand Down
2 changes: 1 addition & 1 deletion Solutions/Ais.Net.Models.Benchmarks/PositionBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Ais.Net.Models.Benchmarks;

using Ais.Net.Models.Abstractions;

using BenchmarkDotNet.Attributes;

namespace Ais.Net.Models.Benchmarks;
/// <summary>
/// Confirms that constructing a <see cref="Position"/> is allocation-free. It was reworked from a
/// <c>record</c> (reference type, 32 B per instance) to a <c>readonly record struct</c>, so this
Expand Down
4 changes: 1 addition & 3 deletions Solutions/Ais.Net.Models.Benchmarks/VesselNameBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
namespace Ais.Net.Models.Benchmarks;

using System;

using Ais.Net.Models;

using BenchmarkDotNet.Attributes;

namespace Ais.Net.Models.Benchmarks;
/// <summary>
/// Compares vessel-name cleaning strategies. The production method currently uses
/// <c>Trim(...).Split(...).Join(...)</c> which allocates a temporary trimmed string, an array,
Expand Down
5 changes: 1 addition & 4 deletions Solutions/Ais.Net.Models.Specs/AisMessageExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
namespace Ais.Net.Models.Specs;

using System;

using Ais.Net;
using Ais.Net.Models;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Shouldly;

namespace Ais.Net.Models.Specs;
[TestClass]
public class AisMessageExtensionsTests
{
Expand Down
4 changes: 1 addition & 3 deletions Solutions/Ais.Net.Models.Specs/AisMessageType18Tests.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
namespace Ais.Net.Models.Specs;

using Ais.Net.Models;
using Ais.Net.Models.Abstractions;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Shouldly;

namespace Ais.Net.Models.Specs;
[TestClass]
public class AisMessageType18Tests
{
Expand Down
Loading
Loading