Skip to content

Commit 35e9395

Browse files
Add initial StyleCop config
1 parent 2c4e4fc commit 35e9395

File tree

16 files changed

+79
-6
lines changed

16 files changed

+79
-6
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ dotnet_diagnostic.SA1121.severity = none
250250
# SA1124: Do not use regions
251251
dotnet_diagnostic.SA1124.severity = suggestion
252252

253+
# SA1201: Elements must appear in the correct order
254+
dotnet_diagnostic.SA1201.severity = suggestion
255+
253256
# SA1202: Elements should be ordered by access
254257
dotnet_diagnostic.SA1202.severity = none
255258

@@ -277,6 +280,9 @@ dotnet_diagnostic.SA1513.severity = none
277280
# SA1600: Elements should be documented
278281
dotnet_diagnostic.SA1600.severity = none
279282

283+
# SA1633: The file header is missing or not located at the top of the file
284+
dotnet_diagnostic.SA1633.severity = none
285+
280286
# S1104: Fields should not have public accessibility
281287
dotnet_diagnostic.S1104.severity = none
282288

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
1717
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" />
1818
<PackageVersion Include="MSTest" Version="4.0.2" />
19+
<PackageVersion Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
1920
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
2021
<PackageVersion Include="System.Memory" Version="4.6.0" />
2122
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />

Directory.csproj.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,13 @@
3939
<!-- Workaround for https://github.com/dotnet/roslyn/issues/41640 -->
4040
<GenerateDocumentationFile>true</GenerateDocumentationFile>
4141
</PropertyGroup>
42+
43+
<!-- StyleCop -->
44+
<ItemGroup>
45+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Visible="false" />
46+
<PackageReference Include="StyleCop.Analyzers.Unstable">
47+
<PrivateAssets>all</PrivateAssets>
48+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
49+
</PackageReference>
50+
</ItemGroup>
4251
</Project>

OpenMcdf.Ole.Tests/OlePropertiesExtensionsTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
namespace OpenMcdf.Ole.Tests;
55

6-
/// <summary>
7-
/// Summary description for UnitTest1.
8-
/// </summary>
96
[TestClass]
107
public class OlePropertiesExtensionsTests
118
{

OpenMcdf.Ole/.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# C# files
2+
[*.cs]
3+
4+
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
5+
6+
# SA1108: Block statements should not contain embedded comments
7+
dotnet_diagnostic.SA1108.severity = none
8+
9+
# SA1204: Static members should appear before non-static members
10+
dotnet_diagnostic.SA1204.severity = none
11+
12+
# SA1515: Single-line comment should be preceded by blank line
13+
dotnet_diagnostic.SA1515.severity = none

OpenMcdf.Ole/TypedPropertyValue.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
internal abstract class TypedPropertyValue<T> : ITypedPropertyValue
44
{
55
private readonly VTPropertyType vtType;
6+
7+
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "TODO")]
68
protected object? propertyValue;
79

810
public PropertyType PropertyType => PropertyType.TypedPropertyValue;

OpenMcdf.Tests/TestData.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ public static class TestData
55
/// <summary>
66
/// Fill with bytes equal to their position modulo 256.
77
/// </summary>
8+
/// <param name="length">The number of bytes to include in the array.</param>
9+
/// <returns>A byte array where each element is set to its index value modulo 256.</returns>
810
public static byte[] CreateByteArray(int length)
911
{
1012
byte[] expectedBuffer = new byte[length];

OpenMcdf.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<File Path="global.json" />
1212
<File Path="License.txt" />
1313
<File Path="README.md" />
14+
<File Path="stylecop.json" />
1415
</Folder>
1516
<Project Path="OpenMcdf.Benchmarks/OpenMcdf.Benchmarks.csproj" />
1617
<Project Path="OpenMcdf.Ole.Tests/OpenMcdf.Ole.Tests.csproj" />

OpenMcdf/DirectoryTree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void Remove(DirectoryEntry entry)
172172
{
173173
uint newRightChildParentId = entry.LeftSiblingId;
174174
DirectoryEntry newRightChildParent;
175-
for (; ; )
175+
while (true)
176176
{
177177
newRightChildParent = directories.GetDictionaryEntry(newRightChildParentId);
178178
newRightChildParentId = newRightChildParent.RightSiblingId;

OpenMcdf/EntryInfo.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
namespace OpenMcdf;
22

3+
/// <summary>
4+
/// Specifies the type of entry for a <see cref="EntryInfo"/>.
5+
/// </summary>
36
public enum EntryType
47
{
8+
/// <summary>
9+
/// A storage entry, which may contain other entries.
10+
/// </summary>
511
Storage,
12+
13+
/// <summary>
14+
/// A stream entry containing binary data.
15+
/// </summary>
616
Stream,
717
}
818

0 commit comments

Comments
 (0)