File tree Expand file tree Collapse file tree 4 files changed +11
-25
lines changed
GitVersion.MsBuild/Helpers Expand file tree Collapse file tree 4 files changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -172,3 +172,6 @@ dotnet_diagnostic.CA1822.severity = warning
172
172
173
173
# CA2208: Instantiate argument exceptions correctly
174
174
dotnet_diagnostic.CA2208.severity = warning
175
+
176
+ # CA1810: Initialize reference type static fields inline
177
+ dotnet_diagnostic.CA1810.severity = warning
Original file line number Diff line number Diff line change @@ -9,24 +9,8 @@ namespace GitVersion.Extensions
9
9
{
10
10
public static class StringExtensions
11
11
{
12
- private static readonly string [ ] Trues ;
13
- private static readonly string [ ] Falses ;
14
-
15
-
16
- static StringExtensions ( )
17
- {
18
- Trues = new [ ]
19
- {
20
- "1" ,
21
- "true"
22
- } ;
23
-
24
- Falses = new [ ]
25
- {
26
- "0" ,
27
- "false"
28
- } ;
29
- }
12
+ private static readonly string [ ] Trues = new [ ] { "1" , "true" } ;
13
+ private static readonly string [ ] Falses = new [ ] { "0" , "false" } ;
30
14
31
15
public static bool IsTrue ( this string value ) => Trues . Contains ( value , StringComparer . OrdinalIgnoreCase ) ;
32
16
Original file line number Diff line number Diff line change @@ -4,11 +4,9 @@ namespace GitVersion.Logging
4
4
{
5
5
public static class Disposable
6
6
{
7
- static Disposable ( ) => Empty = Create ( ( ) => { } ) ;
8
-
9
7
public static IDisposable Create ( Action disposer ) => new AnonymousDisposable ( disposer ) ;
10
8
11
- public static readonly IDisposable Empty ;
9
+ public static readonly IDisposable Empty = Create ( ( ) => { } ) ;
12
10
13
11
private sealed class AnonymousDisposable : IDisposable
14
12
{
Original file line number Diff line number Diff line change @@ -15,12 +15,13 @@ public static class FileHelper
15
15
{ ".vb" , VisualBasicFileContainsVersionAttribute }
16
16
} ;
17
17
18
- public static string TempPath ;
18
+ public static readonly string TempPath = MakeAndGetTempPath ( ) ;
19
19
20
- static FileHelper ( )
20
+ private static string MakeAndGetTempPath ( )
21
21
{
22
- TempPath = Path . Combine ( Path . GetTempPath ( ) , "GitVersionTask" ) ;
23
- Directory . CreateDirectory ( TempPath ) ;
22
+ var tempPath = Path . Combine ( Path . GetTempPath ( ) , "GitVersionTask" ) ;
23
+ Directory . CreateDirectory ( tempPath ) ;
24
+ return tempPath ;
24
25
}
25
26
26
27
public static void DeleteTempFiles ( )
You can’t perform that action at this time.
0 commit comments