From e0f8737c352e2b00a0786b425e388d8c65bb6433 Mon Sep 17 00:00:00 2001 From: Still Hsu Date: Thu, 26 Nov 2020 15:12:56 +0800 Subject: [PATCH] Add initial StyleCops style enforcement --- .gitignore | 5 ++--- StyleAnalyzer.targets | 9 +++++++++ .../Discord.Net.Commands.csproj | 1 + src/Discord.Net.Core/Discord.Net.Core.csproj | 1 + src/Discord.Net.Rest/Discord.Net.Rest.csproj | 1 + .../Discord.Net.WebSocket.csproj | 1 + .../Discord.Net.Webhook.csproj | 1 + stylecop.json | 19 +++++++++++++++++++ 8 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 StyleAnalyzer.targets create mode 100644 stylecop.json diff --git a/.gitignore b/.gitignore index d72e0b5ea..654370842 100644 --- a/.gitignore +++ b/.gitignore @@ -127,7 +127,7 @@ publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings +# TODO: Comment the next line if you want to checkin your web deploy settings # but database connection strings (with potential passwords) will be unencrypted *.pubxml *.publishproj @@ -151,7 +151,6 @@ AppPackages/ # Others *.[Cc]ache ClientBin/ -[Ss]tyle[Cc]op.* ~$* *~ *.dbmdl @@ -206,4 +205,4 @@ docs/api/\.manifest \.idea/ # Codealike UID -codealike.json \ No newline at end of file +codealike.json diff --git a/StyleAnalyzer.targets b/StyleAnalyzer.targets new file mode 100644 index 000000000..bbb90b800 --- /dev/null +++ b/StyleAnalyzer.targets @@ -0,0 +1,9 @@ + + + + + + + true + + diff --git a/src/Discord.Net.Commands/Discord.Net.Commands.csproj b/src/Discord.Net.Commands/Discord.Net.Commands.csproj index 95e7db491..21869d91c 100644 --- a/src/Discord.Net.Commands/Discord.Net.Commands.csproj +++ b/src/Discord.Net.Commands/Discord.Net.Commands.csproj @@ -1,5 +1,6 @@ + Discord.Net.Commands Discord.Commands diff --git a/src/Discord.Net.Core/Discord.Net.Core.csproj b/src/Discord.Net.Core/Discord.Net.Core.csproj index dd2f2afe3..bc513390c 100644 --- a/src/Discord.Net.Core/Discord.Net.Core.csproj +++ b/src/Discord.Net.Core/Discord.Net.Core.csproj @@ -1,5 +1,6 @@ + Discord.Net.Core Discord diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.csproj b/src/Discord.Net.Rest/Discord.Net.Rest.csproj index b9592f18d..8407abfd6 100644 --- a/src/Discord.Net.Rest/Discord.Net.Rest.csproj +++ b/src/Discord.Net.Rest/Discord.Net.Rest.csproj @@ -1,5 +1,6 @@ + Discord.Net.Rest Discord.Rest diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj index 26a249097..01aece130 100644 --- a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj +++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj @@ -1,5 +1,6 @@ + Discord.Net.WebSocket Discord.WebSocket diff --git a/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj b/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj index f1db66363..24ae442d7 100644 --- a/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj +++ b/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj @@ -1,5 +1,6 @@ + Discord.Net.Webhook Discord.Webhook diff --git a/stylecop.json b/stylecop.json new file mode 100644 index 000000000..bb9056963 --- /dev/null +++ b/stylecop.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "indentation": { + "indentationSize": 4, + "tabSize": 4, + "useTabs": false + }, + "documentationRules": { + "documentExposedElements": true, + "documentInternalElements": false, + "documentPrivateElements": false, + "documentInterfaces": true, + "documentPrivateFields": true, + "xmlHeader": false, + "documentationCulture": "en-US" + } + } +}