Skip to content

Commit c6a6788

Browse files
committed
Minor fixes and code style improvements
1 parent 8d0d24d commit c6a6788

10 files changed

Lines changed: 28 additions & 5 deletions

File tree

SpatialFocus.MethodCache.Fody.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">&lt;copyright file="$FILENAME$" company="Spatial Focus GmbH"&gt;
160160
Copyright (c) Spatial Focus GmbH. All rights reserved.
161161
&lt;/copyright&gt;</s:String>
162+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IL/@EntryIndexedValue">IL</s:String>
162163
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
163164
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
164165
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FCONSTANT/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
@@ -207,4 +208,5 @@ Copyright (c) Spatial Focus GmbH. All rights reserved.
207208
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
208209
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
209210
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
211+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fody/@EntryIndexedValue">True</s:Boolean>
210212
</wpf:ResourceDictionary>

src/SpatialFocus.MethodCache.Sample.Library/BasicSample.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ public BasicSample(IMemoryCache memoryCache)
1818
// MethodCache.Fody will look for a property implementing the IMemoryCache
1919
protected IMemoryCache MemoryCache { get; }
2020

21+
#pragma warning disable CA1822 // Mark members as static
2122
public int Add(int a, int b)
2223
{
2324
return a + b;
2425
}
26+
#pragma warning restore CA1822 // Mark members as static
2527
}
2628
}

src/SpatialFocus.MethodCache.Sample.Library/GenericSample.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace SpatialFocus.MethodCache.Sample.Library
77
using Microsoft.Extensions.Caching.Memory;
88

99
// MethodCache.Fody will look for classes and methods decorated with the Cache attribute
10+
[Cache]
1011
public class GenericSample<TClass1, TClass2>
1112
{
1213
public GenericSample(IMemoryCache memoryCache)

src/SpatialFocus.MethodCache.Sample.Library/GenericSampleWeaved.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public GenericSampleWeaved(IMemoryCache memoryCache)
1818

1919
public int Add<TMethod1, TMethod2>(int a, int b, int c, int d)
2020
{
21-
int value;
22-
2321
// Create a unique cache key, based on namespace, class name and method name as first parameter and corresponding
2422
// generic class parameters,generic method parameters and method parameters
2523
Tuple<string, Type, Type, Type, Type, int, int, Tuple<int, int>> key =
@@ -28,7 +26,7 @@ public int Add<TMethod1, TMethod2>(int a, int b, int c, int d)
2826
typeof(TMethod2), a, b, new Tuple<int, int>(c, d));
2927

3028
// Check and return if a cached value exists for key
31-
if (MemoryCache.TryGetValue(key, out value))
29+
if (MemoryCache.TryGetValue(key, out int value))
3230
{
3331
return value;
3432
}

src/SpatialFocus.MethodCache.SmokeTest/Class1.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public Class1(IMemoryCache memoryCache)
1717

1818
public IMemoryCache MemoryCache { get; }
1919

20+
#pragma warning disable CA1801 // Review unused parameters
21+
#pragma warning disable CA1822 // Mark members as static
22+
#pragma warning disable IDE0060 // Remove unused parameter
2023
public int Method1(int a, int b)
2124
{
2225
return a + b;
@@ -26,5 +29,8 @@ public int Method2<TMethod>(int a, string b, double c, float d, object e, Type f
2629
{
2730
return 2;
2831
}
32+
#pragma warning restore CA1801 // Review unused parameters
33+
#pragma warning restore CA1822 // Mark members as static
34+
#pragma warning restore IDE0060 // Remove unused parameter
2935
}
3036
}

src/SpatialFocus.MethodCache.TestAssembly/BasicTestClass.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ public BasicTestClass(IMemoryCache memoryCache)
1616

1717
public IMemoryCache MemoryCache { get; }
1818

19+
#pragma warning disable CA1822 // Mark members as static
1920
public int Add(int a, int b)
2021
{
2122
return a + b;
2223
}
24+
#pragma warning restore CA1822 // Mark members as static
2325
}
2426
}

src/SpatialFocus.MethodCache.TestAssembly/Class1.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public Class1(IMemoryCache memoryCache)
1717

1818
public IMemoryCache MemoryCache { get; }
1919

20+
#pragma warning disable CA1801 // Review unused parameters
21+
#pragma warning disable CA1822 // Mark members as static
22+
#pragma warning disable IDE0060 // Remove unused parameter
2023
public int Method1(int a, int b)
2124
{
2225
return a + b;
@@ -26,5 +29,8 @@ public int Method2<TMethod>(int a, string b, double c, float d, object e, Type f
2629
{
2730
return 2;
2831
}
32+
#pragma warning restore CA1801 // Review unused parameters
33+
#pragma warning restore CA1822 // Mark members as static
34+
#pragma warning restore IDE0060 // Remove unused parameter
2935
}
3036
}

src/SpatialFocus.MethodCache.TestAssembly/GenericMethodTestClass.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public GenericMethodTestClass(IMemoryCache memoryCache)
1616

1717
public IMemoryCache MemoryCache { get; }
1818

19+
#pragma warning disable CA1822 // Mark members as static
1920
public T GenericReturn<T>(T a)
2021
{
2122
return a;
@@ -25,5 +26,6 @@ public int NonGenericReturn(int a)
2526
{
2627
return a;
2728
}
29+
#pragma warning restore CA1822 // Mark members as static
2830
}
2931
}

src/SpatialFocus.MethodCache.TestAssembly/GenericTestClass.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ public GenericTestClass(IMemoryCache memoryCache)
1616

1717
public IMemoryCache MemoryCache { get; }
1818

19+
#pragma warning disable CA1801 // Review unused parameters
20+
#pragma warning disable IDE0060 // Remove unused parameter
1921
public TClass GenericTClassReturn(TClass a)
2022
{
2123
return a;
2224
}
2325

2426
public TClass GenericTClassTMethodReturn<TMethod>(TMethod a)
2527
{
26-
return default(TClass);
28+
return default;
2729
}
2830

2931
public TMethod GenericTMethodReturn<TMethod>(TMethod a)
@@ -35,5 +37,7 @@ public int NonGenericReturn(int a)
3537
{
3638
return a;
3739
}
40+
#pragma warning restore CA1801 // Review unused parameters
41+
#pragma warning restore IDE0060 // Remove unused parameter
3842
}
3943
}

src/SpatialFocus.MethodCache.Tests/SpatialFocus.MethodCache.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
4+
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
55
<DisableFody>true</DisableFody>
66
</PropertyGroup>
77

0 commit comments

Comments
 (0)