Skip to content

Commit 0a65d4d

Browse files
Add StyleCop and fix reported code style issues (#101)
***NO_CI***
1 parent 7859d2b commit 0a65d4d

16 files changed

+166
-69
lines changed

Settings.StyleCop

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<StyleCopSettings Version="105">
2+
<Analyzers>
3+
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
4+
<Rules>
5+
<Rule Name="FileHeaderMustContainFileName">
6+
<RuleSettings>
7+
<BooleanProperty Name="Enabled">False</BooleanProperty>
8+
</RuleSettings>
9+
</Rule>
10+
<Rule Name="FileHeaderMustHaveValidCompanyText">
11+
<RuleSettings>
12+
<BooleanProperty Name="Enabled">False</BooleanProperty>
13+
</RuleSettings>
14+
</Rule>
15+
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
16+
<RuleSettings>
17+
<BooleanProperty Name="Enabled">False</BooleanProperty>
18+
</RuleSettings>
19+
</Rule>
20+
<Rule Name="PropertyDocumentationMustHaveValueText">
21+
<RuleSettings>
22+
<BooleanProperty Name="Enabled">True</BooleanProperty>
23+
</RuleSettings>
24+
</Rule>
25+
<Rule Name="DocumentationTextMustBeginWithACapitalLetter">
26+
<RuleSettings>
27+
<BooleanProperty Name="Enabled">True</BooleanProperty>
28+
</RuleSettings>
29+
</Rule>
30+
<Rule Name="DocumentationTextMustEndWithAPeriod">
31+
<RuleSettings>
32+
<BooleanProperty Name="Enabled">True</BooleanProperty>
33+
</RuleSettings>
34+
</Rule>
35+
<Rule Name="FileHeaderMustShowCopyright">
36+
<RuleSettings>
37+
<BooleanProperty Name="Enabled">False</BooleanProperty>
38+
</RuleSettings>
39+
</Rule>
40+
<Rule Name="FileHeaderMustHaveCopyrightText">
41+
<RuleSettings>
42+
<BooleanProperty Name="Enabled">False</BooleanProperty>
43+
</RuleSettings>
44+
</Rule>
45+
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
46+
<RuleSettings>
47+
<BooleanProperty Name="Enabled">False</BooleanProperty>
48+
</RuleSettings>
49+
</Rule>
50+
<Rule Name="DocumentationTextMustContainWhitespace">
51+
<RuleSettings>
52+
<BooleanProperty Name="Enabled">False</BooleanProperty>
53+
</RuleSettings>
54+
</Rule>
55+
</Rules>
56+
<AnalyzerSettings>
57+
<BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
58+
<BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
59+
</AnalyzerSettings>
60+
</Analyzer>
61+
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
62+
<Rules>
63+
<Rule Name="PrefixLocalCallsWithThis">
64+
<RuleSettings>
65+
<BooleanProperty Name="Enabled">False</BooleanProperty>
66+
</RuleSettings>
67+
</Rule>
68+
<Rule Name="PrefixCallsCorrectly">
69+
<RuleSettings>
70+
<BooleanProperty Name="Enabled">False</BooleanProperty>
71+
</RuleSettings>
72+
</Rule>
73+
</Rules>
74+
<AnalyzerSettings />
75+
</Analyzer>
76+
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
77+
<Rules>
78+
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
79+
<RuleSettings>
80+
<BooleanProperty Name="Enabled">False</BooleanProperty>
81+
</RuleSettings>
82+
</Rule>
83+
<Rule Name="ElementsMustAppearInTheCorrectOrder">
84+
<RuleSettings>
85+
<BooleanProperty Name="Enabled">False</BooleanProperty>
86+
</RuleSettings>
87+
</Rule>
88+
<Rule Name="ElementsMustBeOrderedByAccess">
89+
<RuleSettings>
90+
<BooleanProperty Name="Enabled">False</BooleanProperty>
91+
</RuleSettings>
92+
</Rule>
93+
</Rules>
94+
<AnalyzerSettings />
95+
</Analyzer>
96+
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
97+
<Rules>
98+
<Rule Name="FieldNamesMustNotBeginWithUnderscore">
99+
<RuleSettings>
100+
<BooleanProperty Name="Enabled">False</BooleanProperty>
101+
</RuleSettings>
102+
</Rule>
103+
<Rule Name="FieldNamesMustNotUseHungarianNotation">
104+
<RuleSettings>
105+
<BooleanProperty Name="Enabled">False</BooleanProperty>
106+
</RuleSettings>
107+
</Rule>
108+
</Rules>
109+
<AnalyzerSettings />
110+
</Analyzer>
111+
</Analyzers>
112+
</StyleCopSettings>

System.IO.Ports/Handshake.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
namespace System.IO.Ports
75
{
@@ -37,5 +35,5 @@ public enum Handshake
3735
/// are used.
3836
/// </summary>
3937
RequestToSendXOnXOff
40-
};
41-
}
38+
}
39+
}

System.IO.Ports/Parity.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
namespace System.IO.Ports
75
{
@@ -23,6 +21,6 @@ public enum Parity
2321
/// <summary>
2422
/// Sets the parity bit so that the count of bits set is an even number.
2523
/// </summary>
26-
Even = 2,
27-
};
24+
Even = 2
25+
}
2826
}

System.IO.Ports/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System.Reflection;
1+
// Copyright (c) .NET Foundation and Contributors
2+
// See LICENSE file in the project root for full license information.
3+
4+
using System.Reflection;
25
using System.Runtime.CompilerServices;
36
using System.Runtime.InteropServices;
47

@@ -19,4 +22,3 @@
1922
// to COM components. If you need to access a type in this assembly from
2023
// COM, set the ComVisible attribute to true on that type.
2124
[assembly: ComVisible(false)]
22-

System.IO.Ports/SerialData.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
namespace System.IO.Ports
75
{

System.IO.Ports/SerialDataEvent.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
using nanoFramework.Runtime.Events;
75

System.IO.Ports/SerialDataReceivedEventArgs.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
namespace System.IO.Ports
75
{

System.IO.Ports/SerialDataReceivedEventHandler.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
namespace System.IO.Ports
75
{

System.IO.Ports/SerialDeviceController.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

64
using System.Collections;
75

@@ -21,7 +19,7 @@ internal static class SerialDeviceController
2119
private static ArrayList s_deviceCollection;
2220

2321
/// <summary>
24-
/// Device collection associated with this <see cref="SerialDeviceController"/>.
22+
/// Gets or sets the device collection associated with this <see cref="SerialDeviceController"/>.
2523
/// </summary>
2624
/// <remarks>
2725
/// This collection is for internal use only.

System.IO.Ports/SerialDeviceEventListener.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
//
2-
// Copyright (c) .NET Foundation and Contributors
1+
// Copyright (c) .NET Foundation and Contributors
32
// See LICENSE file in the project root for full license information.
4-
//
53

6-
using nanoFramework.Runtime.Events;
74
using System.Collections;
5+
using nanoFramework.Runtime.Events;
86

97
namespace System.IO.Ports
108
{

0 commit comments

Comments
 (0)