Skip to content

Commit fd0442e

Browse files
committed
updating and adding code style rules
1 parent 0cb22ce commit fd0442e

File tree

16 files changed

+252
-23
lines changed

16 files changed

+252
-23
lines changed

AP.MobileToolkit.sln

+2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AP.MobileToolkit.AAD", "src
1919
EndProject
2020
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AAD47901-F305-41EA-9AB7-BCCC39A07F6A}"
2121
ProjectSection(SolutionItems) = preProject
22+
AvantiPoint.ruleset = AvantiPoint.ruleset
2223
azure-pipelines.yml = azure-pipelines.yml
2324
CodeCoverage.runsettings = CodeCoverage.runsettings
2425
Directory.build.props = Directory.build.props
2526
global.json = global.json
27+
stylecop.json = stylecop.json
2628
EndProjectSection
2729
EndProject
2830
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{365F21D0-A076-4043-906F-DAA4FB2EDBE3}"

AvantiPoint.ruleset

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RuleSet Name="Rules for AvantiPoint" Description="Code analysis rules for AvantiPoint." ToolsVersion="15.0">
3+
<IncludeAll Action="Warning" />
4+
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
5+
<Rule Id="SA0001" Action="None" />
6+
<Rule Id="SA0002" Action="Warning" />
7+
<Rule Id="SA1000" Action="Warning" />
8+
<Rule Id="SA1001" Action="Warning" />
9+
<Rule Id="SA1002" Action="Warning" />
10+
<Rule Id="SA1003" Action="Warning" />
11+
<Rule Id="SA1004" Action="Warning" />
12+
<Rule Id="SA1005" Action="Warning" />
13+
<Rule Id="SA1006" Action="Warning" />
14+
<Rule Id="SA1007" Action="Warning" />
15+
<Rule Id="SA1008" Action="Warning" />
16+
<Rule Id="SA1009" Action="Warning" />
17+
<Rule Id="SA1010" Action="Warning" />
18+
<Rule Id="SA1011" Action="Warning" />
19+
<Rule Id="SA1012" Action="Warning" />
20+
<Rule Id="SA1013" Action="Warning" />
21+
<Rule Id="SA1014" Action="Warning" />
22+
<Rule Id="SA1015" Action="Warning" />
23+
<Rule Id="SA1016" Action="Warning" />
24+
<Rule Id="SA1017" Action="Warning" />
25+
<Rule Id="SA1018" Action="Warning" />
26+
<Rule Id="SA1019" Action="Warning" />
27+
<Rule Id="SA1020" Action="Warning" />
28+
<Rule Id="SA1021" Action="Warning" />
29+
<Rule Id="SA1022" Action="Warning" />
30+
<Rule Id="SA1023" Action="Warning" />
31+
<Rule Id="SA1024" Action="Warning" />
32+
<Rule Id="SA1025" Action="Warning" />
33+
<Rule Id="SA1026" Action="Warning" />
34+
<Rule Id="SA1027" Action="Warning" />
35+
<Rule Id="SA1028" Action="Warning" />
36+
<Rule Id="SA1100" Action="Warning" />
37+
<Rule Id="SA1101" Action="None" />
38+
<Rule Id="SA1102" Action="Warning" />
39+
<Rule Id="SA1103" Action="Warning" />
40+
<Rule Id="SA1104" Action="Warning" />
41+
<Rule Id="SA1105" Action="Warning" />
42+
<Rule Id="SA1106" Action="Warning" />
43+
<Rule Id="SA1107" Action="Warning" />
44+
<Rule Id="SA1108" Action="Warning" />
45+
<Rule Id="SA1109" Action="Warning" />
46+
<Rule Id="SA1110" Action="Warning" />
47+
<Rule Id="SA1111" Action="Warning" />
48+
<Rule Id="SA1112" Action="Warning" />
49+
<Rule Id="SA1113" Action="Warning" />
50+
<Rule Id="SA1114" Action="Warning" />
51+
<Rule Id="SA1115" Action="Warning" />
52+
<Rule Id="SA1116" Action="Warning" />
53+
<Rule Id="SA1117" Action="Warning" />
54+
<Rule Id="SA1118" Action="Warning" />
55+
<Rule Id="SA1119" Action="Warning" />
56+
<Rule Id="SA1120" Action="Warning" />
57+
<Rule Id="SA1121" Action="Warning" />
58+
<Rule Id="SA1122" Action="Warning" />
59+
<Rule Id="SA1123" Action="Warning" />
60+
<Rule Id="SA1124" Action="Warning" />
61+
<Rule Id="SA1125" Action="Warning" />
62+
<Rule Id="SA1126" Action="Warning" />
63+
<Rule Id="SA1127" Action="Warning" />
64+
<Rule Id="SA1128" Action="Warning" />
65+
<Rule Id="SA1129" Action="Warning" />
66+
<Rule Id="SA1130" Action="Warning" />
67+
<Rule Id="SA1131" Action="Warning" />
68+
<Rule Id="SA1132" Action="Warning" />
69+
<Rule Id="SA1133" Action="Warning" />
70+
<Rule Id="SA1134" Action="Warning" />
71+
<Rule Id="SA1135" Action="Warning" />
72+
<Rule Id="SA1136" Action="Warning" />
73+
<Rule Id="SA1137" Action="Warning" />
74+
<Rule Id="SA1139" Action="Warning" />
75+
<Rule Id="SA1200" Action="Warning" />
76+
<Rule Id="SA1201" Action="None" />
77+
<Rule Id="SA1202" Action="None" />
78+
<Rule Id="SA1203" Action="Warning" />
79+
<Rule Id="SA1204" Action="Warning" />
80+
<Rule Id="SA1205" Action="Warning" />
81+
<Rule Id="SA1206" Action="Warning" />
82+
<Rule Id="SA1207" Action="Warning" />
83+
<Rule Id="SA1208" Action="Warning" />
84+
<Rule Id="SA1209" Action="Warning" />
85+
<Rule Id="SA1210" Action="Warning" />
86+
<Rule Id="SA1211" Action="Warning" />
87+
<Rule Id="SA1212" Action="Warning" />
88+
<Rule Id="SA1213" Action="Warning" />
89+
<Rule Id="SA1214" Action="Warning" />
90+
<Rule Id="SA1215" Action="Warning" />
91+
<Rule Id="SA1216" Action="Warning" />
92+
<Rule Id="SA1217" Action="Warning" />
93+
<Rule Id="SA1300" Action="Warning" />
94+
<Rule Id="SA1301" Action="Warning" />
95+
<Rule Id="SA1302" Action="Warning" />
96+
<Rule Id="SA1303" Action="None" />
97+
<Rule Id="SA1304" Action="Warning" />
98+
<Rule Id="SA1305" Action="None" />
99+
<Rule Id="SA1306" Action="Warning" />
100+
<Rule Id="SA1307" Action="Warning" />
101+
<Rule Id="SA1308" Action="Warning" />
102+
<Rule Id="SA1309" Action="Warning" />
103+
<Rule Id="SA1310" Action="Warning" />
104+
<Rule Id="SA1311" Action="None" />
105+
<Rule Id="SA1312" Action="Warning" />
106+
<Rule Id="SA1313" Action="Warning" />
107+
<Rule Id="SA1314" Action="Warning" />
108+
<Rule Id="SA1400" Action="None" />
109+
<Rule Id="SA1401" Action="Warning" />
110+
<Rule Id="SA1402" Action="None" />
111+
<Rule Id="SA1403" Action="Warning" />
112+
<Rule Id="SA1404" Action="Warning" />
113+
<Rule Id="SA1405" Action="Warning" />
114+
<Rule Id="SA1406" Action="Warning" />
115+
<Rule Id="SA1407" Action="Warning" />
116+
<Rule Id="SA1408" Action="Warning" />
117+
<Rule Id="SA1409" Action="Warning" />
118+
<Rule Id="SA1410" Action="Warning" />
119+
<Rule Id="SA1411" Action="Warning" />
120+
<Rule Id="SA1412" Action="Warning" />
121+
<Rule Id="SA1413" Action="None" />
122+
<Rule Id="SA1500" Action="Warning" />
123+
<Rule Id="SA1501" Action="Warning" />
124+
<Rule Id="SA1502" Action="Warning" />
125+
<Rule Id="SA1503" Action="None" />
126+
<Rule Id="SA1504" Action="Warning" />
127+
<Rule Id="SA1505" Action="Warning" />
128+
<Rule Id="SA1506" Action="Warning" />
129+
<Rule Id="SA1507" Action="Warning" />
130+
<Rule Id="SA1508" Action="Warning" />
131+
<Rule Id="SA1509" Action="Warning" />
132+
<Rule Id="SA1510" Action="Warning" />
133+
<Rule Id="SA1511" Action="Warning" />
134+
<Rule Id="SA1512" Action="None" />
135+
<Rule Id="SA1513" Action="None" />
136+
<Rule Id="SA1514" Action="Warning" />
137+
<Rule Id="SA1515" Action="Warning" />
138+
<Rule Id="SA1516" Action="Warning" />
139+
<Rule Id="SA1517" Action="Warning" />
140+
<Rule Id="SA1518" Action="Warning" />
141+
<Rule Id="SA1519" Action="Warning" />
142+
<Rule Id="SA1520" Action="Warning" />
143+
<Rule Id="SA1600" Action="None" />
144+
<Rule Id="SA1601" Action="None" />
145+
<Rule Id="SA1602" Action="None" />
146+
<Rule Id="SA1603" Action="None" />
147+
<Rule Id="SA1604" Action="None" />
148+
<Rule Id="SA1605" Action="None" />
149+
<Rule Id="SA1606" Action="None" />
150+
<Rule Id="SA1607" Action="None" />
151+
<Rule Id="SA1608" Action="None" />
152+
<Rule Id="SA1609" Action="None" />
153+
<Rule Id="SA1610" Action="None" />
154+
<Rule Id="SA1611" Action="None" />
155+
<Rule Id="SA1612" Action="None" />
156+
<Rule Id="SA1613" Action="None" />
157+
<Rule Id="SA1614" Action="None" />
158+
<Rule Id="SA1615" Action="None" />
159+
<Rule Id="SA1616" Action="None" />
160+
<Rule Id="SA1617" Action="None" />
161+
<Rule Id="SA1618" Action="None" />
162+
<Rule Id="SA1619" Action="None" />
163+
<Rule Id="SA1620" Action="None" />
164+
<Rule Id="SA1621" Action="None" />
165+
<Rule Id="SA1622" Action="None" />
166+
<Rule Id="SA1623" Action="None" />
167+
<Rule Id="SA1624" Action="None" />
168+
<Rule Id="SA1625" Action="None" />
169+
<Rule Id="SA1626" Action="Warning" />
170+
<Rule Id="SA1627" Action="None" />
171+
<Rule Id="SA1628" Action="None" />
172+
<Rule Id="SA1629" Action="None" />
173+
<Rule Id="SA1630" Action="None" />
174+
<Rule Id="SA1631" Action="None" />
175+
<Rule Id="SA1632" Action="None" />
176+
<Rule Id="SA1633" Action="None" />
177+
<Rule Id="SA1634" Action="None" />
178+
<Rule Id="SA1635" Action="None" />
179+
<Rule Id="SA1636" Action="None" />
180+
<Rule Id="SA1637" Action="None" />
181+
<Rule Id="SA1638" Action="None" />
182+
<Rule Id="SA1639" Action="None" />
183+
<Rule Id="SA1640" Action="None" />
184+
<Rule Id="SA1641" Action="None" />
185+
<Rule Id="SA1642" Action="None" />
186+
<Rule Id="SA1643" Action="None" />
187+
<Rule Id="SA1644" Action="None" />
188+
<Rule Id="SA1645" Action="None" />
189+
<Rule Id="SA1646" Action="None" />
190+
<Rule Id="SA1647" Action="None" />
191+
<Rule Id="SA1648" Action="None" />
192+
<Rule Id="SA1649" Action="None" />
193+
<Rule Id="SA1650" Action="None" />
194+
<Rule Id="SA1651" Action="None" />
195+
<Rule Id="SA1652" Action="None" />
196+
<Rule Id="SX1101" Action="Warning" />
197+
<Rule Id="SX1309" Action="None" />
198+
<Rule Id="SX1309S" Action="None" />
199+
<Rule Id="xUnit1026" Action="None" />
200+
<!--
201+
=================================================================================================================
202+
Rules that are configured in the stylecop.json file
203+
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md
204+
=================================================================================================================
205+
SA1200: Using directives must be placed correctly.
206+
settings.orderingRules.systemUsingDirectivesFirst
207+
settings.orderingRules.usingDirectivesPlacement
208+
=================================================================================================================
209+
-->
210+
</Rules>
211+
</RuleSet>

Directory.build.props

+16
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,20 @@
2525
<VersionSuffix Condition=" '$(IS_RELEASE)' "></VersionSuffix>
2626
</PropertyGroup>
2727

28+
<PropertyGroup>
29+
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)AvantiPoint.ruleset</CodeAnalysisRuleSet>
30+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta006" PrivateAssets="All" />
35+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" InProject="false" />
36+
</ItemGroup>
37+
38+
<ItemGroup>
39+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
40+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
41+
</PackageReference>
42+
</ItemGroup>
43+
2844
</Project>

azure-pipelines.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
trigger:
22
- master
3-
- rel/*
43

54
name: 3.0.0.$(Build.BuildId)
65

global.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"sdk": {
3+
"version": "2.1.602"
4+
},
25
"msbuild-sdks": {
36
"MSBuild.Sdk.Extras": "2.0.24"
47
}

src/AP.CrossPlatform.Auth/AP.CrossPlatform.Auth.csproj

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9+
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
910
<PackageReference Include="Prism.Core" Version="7.2.0.1233-pre" />
1011
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.4.0" />
11-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
13-
</PackageReference>
12+
1413
</ItemGroup>
1514

1615
</Project>

src/AP.CrossPlatform.Core/AP.CrossPlatform.Core.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
<ItemGroup>
1010
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
1111
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
12-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
13-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
14-
</PackageReference>
1512
</ItemGroup>
1613

1714
</Project>

src/AP.MobileToolkit.AAD/AP.MobileToolkit.AAD.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<ItemGroup>
99
<PackageReference Include="Prism.Plugin.Logging.Abstractions" Version="1.4.0.342-pre" />
1010
<PackageReference Include="Microsoft.Identity.Client" Version="3.0.8" />
11-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
13-
</PackageReference>
1411
</ItemGroup>
1512

1613
<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">

src/AP.MobileToolkit.Http/AP.MobileToolkit.Http.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<ItemGroup>
88
<PackageReference Include="Prism.Plugin.Logging.Abstractions" Version="1.4.0.342-pre" />
99
<PackageReference Include="Xamarin.Essentials.Interfaces" Version="1.1.0" />
10-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
11-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
12-
</PackageReference>
1310
</ItemGroup>
1411

1512
<ItemGroup>

src/AP.MobileToolkit.Modularity/AP.MobileToolkit.Modularity.csproj

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<PackageReference Include="ReactiveUI" Version="9.14.1" />
99
<PackageReference Include="Prism.Forms" Version="7.2.0.1233-pre" />
1010
<PackageReference Include="Prism.Plugin.Logging.Abstractions" Version="1.4.0.342-pre" />
11-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
13-
</PackageReference>
1411
</ItemGroup>
1512

1613
<ItemGroup>

src/AP.MobileToolkit/AP.MobileToolkit.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<ItemGroup Condition=" $(TargetFramework.StartsWith('uap10.0')) ">
3030
<None Remove="**/Platform/UWP/**/*.cs" />
3131
<Compile Include="**/Platform/UWP/**/*.cs" />
32-
<PackageReference Include="Win2D.uwp" Version="1.23.0" />
3332
</ItemGroup>
3433

3534
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
@@ -45,9 +44,6 @@
4544
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.4.0" />
4645
<PackageReference Include="Xamarin.Essentials.Interfaces" Version="1.1.0" />
4746
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
48-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="all">
49-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
50-
</PackageReference>
5147
</ItemGroup>
5248

5349
<ItemGroup>

src/AP.MobileToolkit/Controls/Platform/Droid/TextUtil.cs

+2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public static ICharSequence GetFormattedHtml(string htmlText)
1818
else
1919
{
2020
// handle legacy builds
21+
#pragma warning disable CS0618 // Obsolete API is called only when running on older devices where it is supported.
2122
html = Html.FromHtml(htmlText.ParseCodeTags(), null, new HtmlTagHandler()) as ICharSequence;
23+
#pragma warning disable CS0618
2224
}
2325
// this is required to get rid of the end two "\n" that android adds with Html.FromHtml
2426
// see: http://stackoverflow.com/questions/16585557/extra-padding-on-textview-with-html-contents for example

stylecop.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
3+
4+
"settings": {
5+
"layoutRules": {
6+
"newlineAtEndOfFile": "require"
7+
},
8+
"orderingRules": {
9+
"systemUsingDirectivesFirst": true,
10+
"usingDirectivesPlacement": "outsideNamespace"
11+
}
12+
}
13+
}

tests/AP.CrossPlatform.Auth.Tests/AP.CrossPlatform.Auth.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<DefineConstants>$(DefineConstants);DISABLE_FORMS_INIT</DefineConstants>
77
</PropertyGroup>

tests/AP.CrossPlatform.Core.Tests/AP.CrossPlatform.Core.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<IsPackable>false</IsPackable>
66
</PropertyGroup>
77

tests/AP.MobileToolkit.Http.Tests/AP.MobileToolkit.Http.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.0</TargetFramework>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<IsPackable>false</IsPackable>
66
<DefineConstants>$(DefineConstants);DISABLE_FORMS_INIT</DefineConstants>
77
</PropertyGroup>

0 commit comments

Comments
 (0)