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
172172
173173# CA2208: Instantiate argument exceptions correctly
174174dotnet_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
99{
1010 public static class StringExtensions
1111 {
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" } ;
3014
3115 public static bool IsTrue ( this string value ) => Trues . Contains ( value , StringComparer . OrdinalIgnoreCase ) ;
3216
Original file line number Diff line number Diff line change @@ -4,11 +4,9 @@ namespace GitVersion.Logging
44{
55 public static class Disposable
66 {
7- static Disposable ( ) => Empty = Create ( ( ) => { } ) ;
8-
97 public static IDisposable Create ( Action disposer ) => new AnonymousDisposable ( disposer ) ;
108
11- public static readonly IDisposable Empty ;
9+ public static readonly IDisposable Empty = Create ( ( ) => { } ) ;
1210
1311 private sealed class AnonymousDisposable : IDisposable
1412 {
Original file line number Diff line number Diff line change @@ -15,12 +15,13 @@ public static class FileHelper
1515 { ".vb" , VisualBasicFileContainsVersionAttribute }
1616 } ;
1717
18- public static string TempPath ;
18+ public static readonly string TempPath = MakeAndGetTempPath ( ) ;
1919
20- static FileHelper ( )
20+ private static string MakeAndGetTempPath ( )
2121 {
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 ;
2425 }
2526
2627 public static void DeleteTempFiles ( )
You can’t perform that action at this time.
0 commit comments