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
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
DOTNET_NOLOGO: 1

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
name: Install Current .NET SDK
- name: Restore dependencies
run: dotnet restore /p:TreatWarningsAsErrors=true
- name: Build
run: dotnet build --configuration Release --no-restore /p:TreatWarningsAsErrors=true

nupkg:
name: Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
name: Install Current .NET SDK
- name: Generate NuGet Packages
run: dotnet pack --configuration Release --output nupkg /p:TreatWarningsAsErrors=true
- uses: actions/upload-artifact@v4
if: success() && github.ref == 'refs/heads/main'
with:
name: nupkg
path: nupkg/*
retention-days: 1
20 changes: 20 additions & 0 deletions CodeStyle.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ 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
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Items", "Build Items", "{5C0E54AE-4230-4E3F-AE0B-10C8B504B486}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{92A75F6E-4785-4626-9AD3-D111C0185E23}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
changelog.md = changelog.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -11,4 +25,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
27 changes: 27 additions & 0 deletions CodeStyle/CodeStyle.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<Version>1.0.0</Version>
<PackageId>Polyadic.CodeStyle</PackageId>
<PackageTags>analyzers</PackageTags>
<Description>Various analyzers bundled with opinionated configuration</Description>
<NoWarn>$(NoWarn);NU5104;NU5128</NoWarn>
<!-- NU5104: A stable release of a package should not have a prerelease dependency.
See https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5104 -->
<!-- NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location.
See https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5128 -->
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IDisposableAnalyzers" Version="4.0.2" PrivateAssets="none" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="none" />
</ItemGroup>
<ItemGroup>
<None Include="build\**\*">
<Pack>true</Pack>
<PackagePath>%(Identity)</PackagePath>
</None>
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions CodeStyle/build/Default.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Default rules for all Polyadic projects" ToolsVersion="10.0">
<Include Path="Disposable.ruleset" Action="Default" />
<Include Path="StyleCop.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<Rule Id="CS1591" Action="None" /> <!-- Missing XML comment for publicly visible type or member 'Type_or_Member' -->
</Rules>
</RuleSet>
28 changes: 28 additions & 0 deletions CodeStyle/build/Disposable.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for IDisposable Analyzers" ToolsVersion="10.0">
<Rules AnalyzerId="IDisposableAnalyzers.Correctness" RuleNamespace="IDisposableAnalyzers.Correctness">
<Rule Id="IDISP001" Action="Error" />
<Rule Id="IDISP002" Action="Error" />
<Rule Id="IDISP003" Action="Error" />
<Rule Id="IDISP004" Action="Error" />
<Rule Id="IDISP005" Action="Error" />
<Rule Id="IDISP006" Action="Error" />
<Rule Id="IDISP007" Action="Error" />
<Rule Id="IDISP008" Action="Error" />
<Rule Id="IDISP009" Action="Error" />
<Rule Id="IDISP010" Action="Error" />
<Rule Id="IDISP011" Action="Error" />
<Rule Id="IDISP012" Action="Error" />
<Rule Id="IDISP013" Action="Warning" />
<Rule Id="IDISP014" Action="Error" />
<Rule Id="IDISP015" Action="Error" />
<Rule Id="IDISP016" Action="Error" />
<Rule Id="IDISP017" Action="Error" />
<Rule Id="IDISP018" Action="Error" />
<Rule Id="IDISP019" Action="Error" />
<Rule Id="IDISP020" Action="Error" />
<Rule Id="IDISP021" Action="Error" />
<Rule Id="IDISP022" Action="Error" />
<Rule Id="IDISP023" Action="Error" />
</Rules>
</RuleSet>
4 changes: 4 additions & 0 deletions CodeStyle/build/Polyadic.CodeStyle.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
is_global = true

dotnet_diagnostic.IDE0005.severity = warning # IDE0005: Using directive is unnecessary.
csharp_style_namespace_declarations = file_scoped:error
13 changes: 13 additions & 0 deletions CodeStyle/build/Polyadic.CodeStyle.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Default.ruleset</CodeAnalysisRuleSet>
<WarningsAsErrors Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(WarningsAsErrors);nullable</WarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild><!-- This is needed to enable IDE* rules during build. -->
<GenerateDocumentationFile>true</GenerateDocumentationFile><!-- This is needed so that analyzers can inspect XML comments. Enforced by SA0001. -->
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" Visible="false" InProject="false" />
<GlobalAnalyzerConfigFiles Include="$(MSBuildThisFileDirectory)Polyadic.CodeStyle.editorconfig" />
</ItemGroup>
</Project>
Loading
Loading