From e0550cdc0aaf9f122f068d2747de7c56a7ba520f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Tue, 14 Jan 2025 09:50:17 +0100 Subject: [PATCH 1/7] Copy from Messerli.CodeStyle --- CodeStyle.sln | 8 + CodeStyle/CodeStyle.csproj | 32 +++ CodeStyle/build/Default.ruleset | 8 + CodeStyle/build/Disposable.ruleset | 28 +++ .../build/Messerli.CodeStyle.editorconfig | 4 + CodeStyle/build/Messerli.CodeStyle.props | 13 ++ CodeStyle/build/StyleCop.ruleset | 220 ++++++++++++++++++ CodeStyle/build/stylecop.json | 8 + README.md | 4 + 9 files changed, 325 insertions(+) create mode 100644 CodeStyle/CodeStyle.csproj create mode 100644 CodeStyle/build/Default.ruleset create mode 100644 CodeStyle/build/Disposable.ruleset create mode 100644 CodeStyle/build/Messerli.CodeStyle.editorconfig create mode 100644 CodeStyle/build/Messerli.CodeStyle.props create mode 100644 CodeStyle/build/StyleCop.ruleset create mode 100644 CodeStyle/build/stylecop.json diff --git a/CodeStyle.sln b/CodeStyle.sln index 58ea566..cfc9137 100644 --- a/CodeStyle.sln +++ b/CodeStyle.sln @@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeStyle", "CodeStyle\CodeStyle.csproj", "{F7E4AE8C-8398-461B-AB82-CF7BCE1EB22A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -11,4 +13,10 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F7E4AE8C-8398-461B-AB82-CF7BCE1EB22A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F7E4AE8C-8398-461B-AB82-CF7BCE1EB22A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F7E4AE8C-8398-461B-AB82-CF7BCE1EB22A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F7E4AE8C-8398-461B-AB82-CF7BCE1EB22A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection EndGlobal diff --git a/CodeStyle/CodeStyle.csproj b/CodeStyle/CodeStyle.csproj new file mode 100644 index 0000000..1f9a47b --- /dev/null +++ b/CodeStyle/CodeStyle.csproj @@ -0,0 +1,32 @@ + + + + 2.3.1 + Messerli.CodeStyle + analyzers + Various analyzers bundled with opinionated configuration + $(NoWarn);NU5105;NU5104;NU5128 + + + + + + netstandard2.0 + + + + + + + + + + + true + %(Identity) + + + diff --git a/CodeStyle/build/Default.ruleset b/CodeStyle/build/Default.ruleset new file mode 100644 index 0000000..01d5707 --- /dev/null +++ b/CodeStyle/build/Default.ruleset @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/CodeStyle/build/Disposable.ruleset b/CodeStyle/build/Disposable.ruleset new file mode 100644 index 0000000..fcdf939 --- /dev/null +++ b/CodeStyle/build/Disposable.ruleset @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CodeStyle/build/Messerli.CodeStyle.editorconfig b/CodeStyle/build/Messerli.CodeStyle.editorconfig new file mode 100644 index 0000000..7405d6e --- /dev/null +++ b/CodeStyle/build/Messerli.CodeStyle.editorconfig @@ -0,0 +1,4 @@ +is_global = true + +dotnet_diagnostic.IDE0005.severity = warning # IDE0005: Using directive is unnecessary. +csharp_style_namespace_declarations = file_scoped:error diff --git a/CodeStyle/build/Messerli.CodeStyle.props b/CodeStyle/build/Messerli.CodeStyle.props new file mode 100644 index 0000000..e94dc94 --- /dev/null +++ b/CodeStyle/build/Messerli.CodeStyle.props @@ -0,0 +1,13 @@ + + + + $(MSBuildThisFileDirectory)Default.ruleset + $(WarningsAsErrors);nullable + true + true + + + + + + diff --git a/CodeStyle/build/StyleCop.ruleset b/CodeStyle/build/StyleCop.ruleset new file mode 100644 index 0000000..ee220b4 --- /dev/null +++ b/CodeStyle/build/StyleCop.ruleset @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CodeStyle/build/stylecop.json b/CodeStyle/build/stylecop.json new file mode 100644 index 0000000..04cc7a0 --- /dev/null +++ b/CodeStyle/build/stylecop.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "orderingRules": { + "usingDirectivesPlacement": "outsideNamespace" + } + } +} diff --git a/README.md b/README.md index 31a72d1..75510be 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ Shared Code Style for all Polyadic/Funcky projects. The rules are configured with the expectation that you build with `/p:TreatWarningsAsErrors=true` on CI. +## Credits +The `Polyadic.CodeStyle` package started as a direct copy of +[`Messerli.CodeStyle`](https://github.com/messerli-informatik-ag/code-style), licensed under either Apache 2.0 or MIT. + ## License Licensed under either of From 20da97fd5ea3cc32c9c07c981bdd1e6318c50319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Tue, 14 Jan 2025 09:50:24 +0100 Subject: [PATCH 2/7] Fix build --- Directory.Build.props | 18 ++++++++++++++++++ global.json | 9 +++++++++ 2 files changed, 27 insertions(+) create mode 100644 Directory.Build.props create mode 100644 global.json diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..e9522b5 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,18 @@ + + + + Polyadic + MIT OR Apache-2.0 + https://github.com/polyadic/code-style + © Polyadic. All rights reserved. + + + 5.0 + + + enable + + + $(MSBuildThisFileDirectory)artifacts + + diff --git a/global.json b/global.json new file mode 100644 index 0000000..71cf3fc --- /dev/null +++ b/global.json @@ -0,0 +1,9 @@ +{ + "sdk": { + "version": "9.0.100", + "rollForward": "feature" + }, + "msbuild-sdks": { + "Microsoft.Build.NoTargets": "3.7.56" + } +} From 6695fb6ad8fa7fdfd41a1851d64620f1b38cbb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Tue, 14 Jan 2025 09:51:47 +0100 Subject: [PATCH 3/7] Remove reference to own analyzers --- CodeStyle/CodeStyle.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/CodeStyle/CodeStyle.csproj b/CodeStyle/CodeStyle.csproj index 1f9a47b..ac86d16 100644 --- a/CodeStyle/CodeStyle.csproj +++ b/CodeStyle/CodeStyle.csproj @@ -20,9 +20,6 @@ - - - true From 955393075adc7eba54ced692b71aff7672c5ca9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Tue, 14 Jan 2025 09:54:00 +0100 Subject: [PATCH 4/7] Rename package --- CodeStyle/CodeStyle.csproj | 4 ++-- CodeStyle/build/Default.ruleset | 2 +- ...CodeStyle.editorconfig => Polyadic.CodeStyle.editorconfig} | 0 .../{Messerli.CodeStyle.props => Polyadic.CodeStyle.props} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename CodeStyle/build/{Messerli.CodeStyle.editorconfig => Polyadic.CodeStyle.editorconfig} (100%) rename CodeStyle/build/{Messerli.CodeStyle.props => Polyadic.CodeStyle.props} (95%) diff --git a/CodeStyle/CodeStyle.csproj b/CodeStyle/CodeStyle.csproj index ac86d16..fae3c7c 100644 --- a/CodeStyle/CodeStyle.csproj +++ b/CodeStyle/CodeStyle.csproj @@ -1,8 +1,8 @@ - 2.3.1 - Messerli.CodeStyle + 1.0.0 + Polyadic.CodeStyle analyzers Various analyzers bundled with opinionated configuration $(NoWarn);NU5105;NU5104;NU5128 diff --git a/CodeStyle/build/Default.ruleset b/CodeStyle/build/Default.ruleset index 01d5707..63604f5 100644 --- a/CodeStyle/build/Default.ruleset +++ b/CodeStyle/build/Default.ruleset @@ -1,5 +1,5 @@ - + diff --git a/CodeStyle/build/Messerli.CodeStyle.editorconfig b/CodeStyle/build/Polyadic.CodeStyle.editorconfig similarity index 100% rename from CodeStyle/build/Messerli.CodeStyle.editorconfig rename to CodeStyle/build/Polyadic.CodeStyle.editorconfig diff --git a/CodeStyle/build/Messerli.CodeStyle.props b/CodeStyle/build/Polyadic.CodeStyle.props similarity index 95% rename from CodeStyle/build/Messerli.CodeStyle.props rename to CodeStyle/build/Polyadic.CodeStyle.props index e94dc94..3208a5d 100644 --- a/CodeStyle/build/Messerli.CodeStyle.props +++ b/CodeStyle/build/Polyadic.CodeStyle.props @@ -8,6 +8,6 @@ - + From c628760213eecda88a41619f1af27d4d686f44ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tau=20G=C3=A4rtli?= Date: Tue, 14 Jan 2025 09:54:23 +0100 Subject: [PATCH 5/7] Remove not needed nowarn --- CodeStyle/CodeStyle.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CodeStyle/CodeStyle.csproj b/CodeStyle/CodeStyle.csproj index fae3c7c..90a470b 100644 --- a/CodeStyle/CodeStyle.csproj +++ b/CodeStyle/CodeStyle.csproj @@ -5,9 +5,7 @@ Polyadic.CodeStyle analyzers Various analyzers bundled with opinionated configuration - $(NoWarn);NU5105;NU5104;NU5128 - + $(NoWarn);NU5104;NU5128