Add StyleCop support
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 29 Sep 2020 09:54:10 +0000 (11:54 +0200)
committerPiotr Czaja <p.czaja@samsung.com>
Tue, 14 Sep 2021 11:01:33 +0000 (13:01 +0200)
Fitness/Fitness.csproj
Fitness/FitnessApp.cs [moved from Fitness/Fitness.cs with 88% similarity]
Fitness/Settings.StyleCop [new file with mode: 0644]
Fitness/stylecop.json [new file with mode: 0644]

index 8cb3550..52b1ac5 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Exe</OutputType>
     <TargetFramework>tizen80</TargetFramework>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
   <ItemGroup>
     <Folder Include="lib\"/>
     <Folder Include="res\"/>
+    <AdditionalFiles Include="stylecop.json" />
   </ItemGroup>
 
   <ItemGroup>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
     <PackageReference Include="Tizen.NET" Version="8.0.0.15595" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
 
 </Project>
similarity index 88%
rename from Fitness/Fitness.cs
rename to Fitness/FitnessApp.cs
index 78f82f2..60f27fc 100644 (file)
@@ -2,17 +2,17 @@
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 
-namespace fitness
+namespace Fitness
 {
-    class Program : NUIApplication
+    public class FitnessApp : NUIApplication
     {
-        protected override void OnCreate()
+        public static void Main(string[] args)
         {
-            base.OnCreate();
-            Initialize();
+            var app = new FitnessApp();
+            app.Run(args);
         }
 
-        void Initialize()
+        public void Initialize()
         {
             Window.Instance.KeyEvent += OnKeyEvent;
 
@@ -40,10 +40,10 @@ namespace fitness
             }
         }
 
-        static void Main(string[] args)
+        protected override void OnCreate()
         {
-            var app = new Program();
-            app.Run(args);
+            base.OnCreate();
+            Initialize();
         }
     }
 }
diff --git a/Fitness/Settings.StyleCop b/Fitness/Settings.StyleCop
new file mode 100644 (file)
index 0000000..32b04b3
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RuleSet Name="Rules for ConsoleApp" Description="Code analysis rules" ToolsVersion="16.0">
+  <IncludeAll Action="Warning" />
+  <Rules AnalyzerId="StyleCop.CSharp" RuleNamespace="StyleCop.CSharp">
+    <!-- SA1101PrefixLocalCallsWithThis -->
+    <!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1101.md -->
+    <Rule Id="SA1101" Action="None" />
+    <!-- UsingDirectivesMustBePlacedCorrectly -->
+    <!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md -->
+    <Rule Id="SA1200" Action="None" />
+    <!-- Check XML style -->
+    <Rule Id="SA0001" Action="None" />
+    <!-- Currently use no license -->
+    <Rule Id="SA1633" Action="None" />
+  </Rules>
+</RuleSet>
diff --git a/Fitness/stylecop.json b/Fitness/stylecop.json
new file mode 100644 (file)
index 0000000..1d25428
--- /dev/null
@@ -0,0 +1,11 @@
+{
+  "settings": {
+    "indentation": {
+        "indentationSize": 4,
+        "useTabs": false
+    },
+    "layoutRules": {
+        "newlineAtEndOfFile": "require"
+    }
+  }
+}