Skip to content

Commit 2cf2e46

Browse files
Merge pull request #1090 from brianpopow/feature/stylecopTests
Use stylecop in Test project
2 parents 889e2c4 + 1f3311b commit 2cf2e46

File tree

365 files changed

+3506
-3554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+3506
-3554
lines changed

.editorconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ csharp_space_between_square_brackets = false
339339
# warn when using var for built-in types,
340340
# warn when using var when the type is not apparent, and
341341
# warn when not using var when the type is apparent
342+
# warn when using simplified "using" declaration
342343
###############################################################################
343344
[*.cs]
344345
csharp_prefer_braces = true:silent
@@ -367,6 +368,8 @@ csharp_style_throw_expression = true:suggestion
367368
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
368369
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
369370

370-
csharp_style_var_for_built_in_types = false:warning
371-
csharp_style_var_elsewhere = false:warning
371+
csharp_style_var_for_built_in_types = false:silent
372372
csharp_style_var_when_type_is_apparent = true:warning
373+
csharp_style_var_elsewhere = false:warning
374+
375+
csharp_prefer_simple_using_statement = false:silent

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@
9696
*.gif binary
9797
*.jpg binary
9898
*.ktx binary
99+
*.otf binary
99100
*.pbm binary
100101
*.pdf binary
101102
*.png binary
102103
*.ppt binary
103104
*.pptx binary
104105
*.pvr binary
105-
*.ttf binary
106106
*.snk binary
107107
*.tga binary
108+
*.ttc binary
108109
*.ttf binary
109110
*.woff binary
110111
*.woff2 binary
111112
*.xls binary
112113
*.xlsx binary
113114

114-
115115
###############################################################################
116116
# Set explicit file behavior to:
117117
# diff as plain text

Directory.Build.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@
103103
<ItemGroup>
104104
<PackageReference Include="Microsoft.Net.Compilers.Toolset" IsImplicitlyDefined="true" />
105105
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" IsImplicitlyDefined="true" />
106-
<!--TODO: Enable this once tests Stylecop issues are fixed-->
107-
<!--<PackageReference Include="StyleCop.Analyzers" IsImplicitlyDefined="true" />-->
106+
<PackageReference Include="StyleCop.Analyzers" IsImplicitlyDefined="true" />
108107
<AdditionalFiles Include="$(MSBuildThisFileDirectory)shared-infrastructure\stylecop.json" />
109108
<!--NuGet package icon source-->
110109
<None Include="$(MSBuildThisFileDirectory)shared-infrastructure\branding\icons\imagesharp\sixlabors.imagesharp.128.png" Pack="true" PackagePath="\icon.png" />

src/Directory.Build.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<!--TODO: Delete this once tests Stylecop issues are fixed-->
31-
<PackageReference Include="StyleCop.Analyzers" IsImplicitlyDefined="true" />
32-
3330
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" PublicKey="0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
3431
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKeyToken=null" />
3532
<InternalsVisibleTo Include="ImageSharp.Benchmarks" />

src/ImageSharp/Advanced/ParallelUtils/ParallelHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static class ParallelHelper
2626
/// <param name="body">The method body defining the iteration logic on a single <see cref="RowInterval"/>.</param>
2727
public static void IterateRows(Rectangle rectangle, Configuration configuration, Action<RowInterval> body)
2828
{
29-
ParallelExecutionSettings parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
29+
var parallelSettings = ParallelExecutionSettings.FromConfiguration(configuration);
3030

3131
IterateRows(rectangle, parallelSettings, body);
3232
}

src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.TagDataEntry.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public IccChromaticityTagDataEntry ReadChromaticityTagDataEntry()
153153
else
154154
{
155155
// The type is not know, so the values need be read
156-
var values = new double[channelCount][];
156+
double[][] values = new double[channelCount][];
157157
for (int i = 0; i < channelCount; i++)
158158
{
159159
values[i] = new double[] { this.ReadUFix16(), this.ReadUFix16() };
@@ -208,7 +208,7 @@ public IccCurveTagDataEntry ReadCurveTagDataEntry()
208208
return new IccCurveTagDataEntry(this.ReadUFix8());
209209
}
210210

211-
var cdata = new float[pointCount];
211+
float[] cdata = new float[pointCount];
212212
for (int i = 0; i < pointCount; i++)
213213
{
214214
cdata[i] = this.ReadUInt16() / 65535f;
@@ -264,7 +264,7 @@ public IccLut16TagDataEntry ReadLut16TagDataEntry()
264264

265265
// Input LUT
266266
var inValues = new IccLut[inChCount];
267-
var gridPointCount = new byte[inChCount];
267+
byte[] gridPointCount = new byte[inChCount];
268268
for (int i = 0; i < inChCount; i++)
269269
{
270270
inValues[i] = this.ReadLut16(inTableCount);
@@ -299,7 +299,7 @@ public IccLut8TagDataEntry ReadLut8TagDataEntry()
299299

300300
// Input LUT
301301
var inValues = new IccLut[inChCount];
302-
var gridPointCount = new byte[inChCount];
302+
byte[] gridPointCount = new byte[inChCount];
303303
for (int i = 0; i < inChCount; i++)
304304
{
305305
inValues[i] = this.ReadLut8();
@@ -464,8 +464,8 @@ public IccMultiLocalizedUnicodeTagDataEntry ReadMultiLocalizedUnicodeTagDataEntr
464464
var text = new IccLocalizedString[recordCount];
465465

466466
var culture = new CultureInfo[recordCount];
467-
var length = new uint[recordCount];
468-
var offset = new uint[recordCount];
467+
uint[] length = new uint[recordCount];
468+
uint[] offset = new uint[recordCount];
469469

470470
for (int i = 0; i < recordCount; i++)
471471
{
@@ -627,7 +627,7 @@ public IccResponseCurveSet16TagDataEntry ReadResponseCurveSet16TagDataEntry()
627627
ushort channelCount = this.ReadUInt16();
628628
ushort measurementCount = this.ReadUInt16();
629629

630-
var offset = new uint[measurementCount];
630+
uint[] offset = new uint[measurementCount];
631631
for (int i = 0; i < measurementCount; i++)
632632
{
633633
offset[i] = this.ReadUInt32();
@@ -651,7 +651,7 @@ public IccResponseCurveSet16TagDataEntry ReadResponseCurveSet16TagDataEntry()
651651
public IccFix16ArrayTagDataEntry ReadFix16ArrayTagDataEntry(uint size)
652652
{
653653
uint count = (size - 8) / 4;
654-
var arrayData = new float[count];
654+
float[] arrayData = new float[count];
655655
for (int i = 0; i < count; i++)
656656
{
657657
arrayData[i] = this.ReadFix16() / 256f;
@@ -687,7 +687,7 @@ public IccTextTagDataEntry ReadTextTagDataEntry(uint size)
687687
public IccUFix16ArrayTagDataEntry ReadUFix16ArrayTagDataEntry(uint size)
688688
{
689689
uint count = (size - 8) / 4;
690-
var arrayData = new float[count];
690+
float[] arrayData = new float[count];
691691
for (int i = 0; i < count; i++)
692692
{
693693
arrayData[i] = this.ReadUFix16();
@@ -704,7 +704,7 @@ public IccUFix16ArrayTagDataEntry ReadUFix16ArrayTagDataEntry(uint size)
704704
public IccUInt16ArrayTagDataEntry ReadUInt16ArrayTagDataEntry(uint size)
705705
{
706706
uint count = (size - 8) / 2;
707-
var arrayData = new ushort[count];
707+
ushort[] arrayData = new ushort[count];
708708
for (int i = 0; i < count; i++)
709709
{
710710
arrayData[i] = this.ReadUInt16();
@@ -721,7 +721,7 @@ public IccUInt16ArrayTagDataEntry ReadUInt16ArrayTagDataEntry(uint size)
721721
public IccUInt32ArrayTagDataEntry ReadUInt32ArrayTagDataEntry(uint size)
722722
{
723723
uint count = (size - 8) / 4;
724-
var arrayData = new uint[count];
724+
uint[] arrayData = new uint[count];
725725
for (int i = 0; i < count; i++)
726726
{
727727
arrayData[i] = this.ReadUInt32();
@@ -738,7 +738,7 @@ public IccUInt32ArrayTagDataEntry ReadUInt32ArrayTagDataEntry(uint size)
738738
public IccUInt64ArrayTagDataEntry ReadUInt64ArrayTagDataEntry(uint size)
739739
{
740740
uint count = (size - 8) / 8;
741-
var arrayData = new ulong[count];
741+
ulong[] arrayData = new ulong[count];
742742
for (int i = 0; i < count; i++)
743743
{
744744
arrayData[i] = this.ReadUInt64();
@@ -878,14 +878,14 @@ public IccScreeningTagDataEntry ReadScreeningTagDataEntry()
878878
public IccUcrBgTagDataEntry ReadUcrBgTagDataEntry(uint size)
879879
{
880880
uint ucrCount = this.ReadUInt32();
881-
var ucrCurve = new ushort[ucrCount];
881+
ushort[] ucrCurve = new ushort[ucrCount];
882882
for (int i = 0; i < ucrCurve.Length; i++)
883883
{
884884
ucrCurve[i] = this.ReadUInt16();
885885
}
886886

887887
uint bgCount = this.ReadUInt32();
888-
var bgCurve = new ushort[bgCount];
888+
ushort[] bgCurve = new ushort[bgCount];
889889
for (int i = 0; i < bgCurve.Length; i++)
890890
{
891891
bgCurve[i] = this.ReadUInt16();

src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccLutAToBTagDataEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors and contributors.
1+
// Copyright (c) Six Labors and contributors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;

src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccLutBToATagDataEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors and contributors.
1+
// Copyright (c) Six Labors and contributors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;

src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccXyzTagDataEntry.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Numerics;
6+
using System.Runtime.CompilerServices;
67

78
namespace SixLabors.ImageSharp.Metadata.Profiles.Icc
89
{
@@ -53,4 +54,4 @@ public bool Equals(IccXyzTagDataEntry other)
5354
return this.Equals((IccTagDataEntry)other);
5455
}
5556
}
56-
}
57+
}

0 commit comments

Comments
 (0)