Skip to content

Commit f07ba36

Browse files
authored
Update CSharpier to 0.30.3 (#2912)
* Update CSharpier to 0.30.3 * Update .editorconfig to match CSharpier suggestion configuration * Enable collection expressions by default
1 parent 86eaa35 commit f07ba36

File tree

93 files changed

+908
-1006
lines changed

Some content is hidden

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

93 files changed

+908
-1006
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"csharpier": {
6-
"version": "0.28.2",
6+
"version": "0.30.3",
77
"commands": ["dotnet-csharpier"],
88
"rollForward": false
99
}

.editorconfig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ csharp_style_prefer_primary_constructors = true:suggestion
9191
csharp_style_prefer_readonly_struct_member = true:suggestion
9292
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
9393
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
94+
csharp_prefer_system_threading_lock = true:suggestion
9495

9596
[*.{cs,vb}]
9697
tab_width = 4
@@ -174,7 +175,7 @@ dotnet_style_qualification_for_field = false:silent
174175
dotnet_style_qualification_for_property = false:silent
175176
dotnet_style_qualification_for_method = false:silent
176177
dotnet_style_qualification_for_event = false:silent
177-
dotnet_style_prefer_collection_expression = true:suggestion
178+
dotnet_style_prefer_collection_expression = when_types_exactly_match:warning
178179
dotnet_sort_system_directives_first = true
179180

180181
# Define the 'private_fields' symbol group:
@@ -214,7 +215,6 @@ dotnet_diagnostic.CA1829.severity = warning # Use the Count or Length property i
214215
dotnet_diagnostic.CA1834.severity = warning # Use 'StringBuilder.Append(char)' instead of 'StringBuilder.Append(string)'
215216
dotnet_diagnostic.CA2016.severity = warning # Forward the 'token' parameter to the async method
216217

217-
# Downgrade the following code style diagnostic messages so dotnet format does not fix them automatically.]]
218-
# NOTE: Consider changing to warning when migrating from .NET 6.
219-
# The following diagnostic is automatically fixed in .NET SDK 7.0.304 or higher - older versions will cause variance.
220-
dotnet_diagnostic.IDE0270.severity = suggestion # Null check can be simplified
218+
# This rule conflicts with CSharpier
219+
# See https://csharpier.com/docs/IntegratingWithLinters
220+
dotnet_diagnostic.IDE0055.severity = none

src/Help/UpdateHelp/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void Main(string[] args)
7171
{
7272
{ "es", "9f727aa1dd179dd6d" },
7373
{ "fr", "7da597faaebed6cc7" },
74-
{ "pt_BR", "40bf11d4080246d99" }
74+
{ "pt_BR", "40bf11d4080246d99" },
7575
};
7676

7777
Console.WriteLine("Update Help files.\n");
@@ -152,7 +152,7 @@ static Dictionary<string, string> ExtractHtmlTranslations(string sourcePath, str
152152

153153
string[] htmlFiles = Directory.GetFiles(targetPath, "*.htm", SearchOption.AllDirectories);
154154
// auxiliary html files with titles or headings that can be ignored
155-
string[] ignoreFiles = { "index1.htm", "csh-redirect.htm" };
155+
string[] ignoreFiles = ["index1.htm", "csh-redirect.htm"];
156156
IEnumerable<string> targetFiles = htmlFiles.Where(t => !ignoreFiles.Contains(Path.GetFileName(t)));
157157
foreach (string file in targetFiles)
158158
{

src/Migrations/BackoutCommits/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private static async Task<string> RunCommandAsync(string program, string argumen
230230
Arguments = arguments,
231231
UseShellExecute = false,
232232
RedirectStandardOutput = true,
233-
RedirectStandardError = true
233+
RedirectStandardError = true,
234234
};
235235
process.Start();
236236
while (!process.HasExited)

src/Migrations/PTDDCloneAll.Tests/CloneAllServiceTests.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ public TestEnvironment()
8686
ParatextTokens = new Tokens
8787
{
8888
AccessToken = "test_access_token1",
89-
RefreshToken = "test_refresh_token1"
90-
}
89+
RefreshToken = "test_refresh_token1",
90+
},
9191
},
9292
new UserSecret
9393
{
9494
Id = "user03",
9595
ParatextTokens = new Tokens
9696
{
9797
AccessToken = "test_access_token2",
98-
RefreshToken = "test_refresh_token2"
99-
}
100-
}
98+
RefreshToken = "test_refresh_token2",
99+
},
100+
},
101101
}
102102
);
103103

@@ -131,7 +131,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
131131
{
132132
new User { Id = "user01", ParatextId = "pt01" },
133133
new User { Id = "user02", ParatextId = "pt02" },
134-
new User { Id = "user03", ParatextId = "pt03" }
134+
new User { Id = "user03", ParatextId = "pt03" },
135135
}
136136
)
137137
);
@@ -150,7 +150,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
150150
{
151151
{ "user01", SFProjectRole.Administrator },
152152
{ "user02", SFProjectRole.Translator },
153-
{ "user03", SFProjectRole.Administrator }
153+
{ "user03", SFProjectRole.Administrator },
154154
},
155155
ParatextId = "target01",
156156
TranslateConfig = new TranslateConfig
@@ -161,11 +161,11 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
161161
ParatextId = "source01",
162162
Name = "Source",
163163
ShortName = "SRC",
164-
WritingSystem = new WritingSystem { Tag = "en" }
165-
}
164+
WritingSystem = new WritingSystem { Tag = "en" },
165+
},
166166
},
167167
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
168-
Sync = new Sync { QueuedCount = 1 }
168+
Sync = new Sync { QueuedCount = 1 },
169169
},
170170
new SFProject
171171
{
@@ -176,7 +176,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
176176
{
177177
{ "user01", SFProjectRole.Administrator },
178178
{ "user02", SFProjectRole.Translator },
179-
{ "user03", SFProjectRole.Administrator }
179+
{ "user03", SFProjectRole.Administrator },
180180
},
181181
ParatextId = "target02",
182182
TranslateConfig = new TranslateConfig
@@ -187,12 +187,12 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
187187
ParatextId = "source02",
188188
Name = "Source",
189189
ShortName = "SR2",
190-
WritingSystem = new WritingSystem { Tag = "en" }
191-
}
190+
WritingSystem = new WritingSystem { Tag = "en" },
191+
},
192192
},
193193
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
194-
Sync = new Sync { QueuedCount = 1 }
195-
}
194+
Sync = new Sync { QueuedCount = 1 },
195+
},
196196
}
197197
)
198198
);

src/Migrations/PTDDCloneAll/PTDDSyncRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ async Task createText(int chapterNum, Delta delta)
524524
Number = kvp.Key,
525525
LastVerse = kvp.Value.LastVerse,
526526
IsValid = kvp.Value.IsValid,
527-
Permissions = { }
527+
Permissions = { },
528528
}
529529
);
530530
}

src/Migrations/PtdaSyncAll.Tests/PtdaSyncRunnerTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ public async Task SyncAsync_TextDocAlreadyExists()
477477
.Add(
478478
new TextData(Delta.New().InsertText("old text"))
479479
{
480-
Id = TextData.GetTextDocId("project01", 42, 1, TextType.Target)
480+
Id = TextData.GetTextDocId("project01", 42, 1, TextType.Target),
481481
}
482482
);
483483
env.SetupPTData(new Book("MAT", 2), new Book("MRK", 2), new Book("LUK", 2));
@@ -529,7 +529,7 @@ public async Task SyncBookUSxAsync_InvalidBookStateAndNoTextData_SkipSync()
529529
Book matBook = new Book("MAT", 3, 3)
530530
{
531531
MissingTargetChapters = { 1, 2, 3 },
532-
MissingSourceChapters = { 1, 2, 3 }
532+
MissingSourceChapters = { 1, 2, 3 },
533533
};
534534
env.SetupSFData(true, true, false, matBook);
535535
env.SetupPTData(new Book("MAT", 3, true));
@@ -762,7 +762,7 @@ public async Task ChangeDbToNewSnapshotAsync_Works()
762762
var book = new Book("MAT", numberChapters, true)
763763
{
764764
MissingTargetChapters = missingDbChapters,
765-
MissingSourceChapters = missingDbChapters
765+
MissingSourceChapters = missingDbChapters,
766766
};
767767
env.SetupSFData(true, true, false, book);
768768

@@ -847,7 +847,7 @@ public TestEnvironment()
847847
var ptUserRoles = new Dictionary<string, string>
848848
{
849849
{ "pt01", SFProjectRole.Administrator },
850-
{ "pt02", SFProjectRole.Translator }
850+
{ "pt02", SFProjectRole.Translator },
851851
};
852852
ParatextService
853853
.GetProjectRolesAsync(Arg.Any<UserSecret>(), "target")
@@ -930,7 +930,7 @@ params Book[] books
930930
new[]
931931
{
932932
new User { Id = "user01", ParatextId = "pt01" },
933-
new User { Id = "user02", ParatextId = "pt02" }
933+
new User { Id = "user02", ParatextId = "pt02" },
934934
}
935935
)
936936
);
@@ -948,7 +948,7 @@ params Book[] books
948948
UserRoles = new Dictionary<string, string>
949949
{
950950
{ "user01", SFProjectRole.Administrator },
951-
{ "user02", SFProjectRole.Translator }
951+
{ "user02", SFProjectRole.Translator },
952952
},
953953
ParatextId = "target",
954954
TranslateConfig = new TranslateConfig
@@ -959,13 +959,13 @@ params Book[] books
959959
ParatextId = "source",
960960
Name = "Source",
961961
ShortName = "SRC",
962-
WritingSystem = new WritingSystem { Tag = "en" }
963-
}
962+
WritingSystem = new WritingSystem { Tag = "en" },
963+
},
964964
},
965965
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
966966
Texts = books.Select(b => TextInfoFromBook(b)).ToList(),
967-
Sync = new Sync { QueuedCount = 1 }
968-
}
967+
Sync = new Sync { QueuedCount = 1 },
968+
},
969969
}
970970
)
971971
);
@@ -1022,10 +1022,10 @@ public TextInfo TextInfoFromBook(Book book)
10221022
{
10231023
Number = c,
10241024
LastVerse = 10,
1025-
IsValid = !book.InvalidChapters.Contains(c)
1025+
IsValid = !book.InvalidChapters.Contains(c),
10261026
})
10271027
.ToList(),
1028-
HasSource = book.HighestSourceChapter > 0
1028+
HasSource = book.HighestSourceChapter > 0,
10291029
};
10301030
}
10311031

@@ -1175,8 +1175,8 @@ private void AddSFBook(
11751175
Id = $"project01:question{bookId}{c}",
11761176
DataId = $"question{bookId}{c}",
11771177
ProjectRef = "project01",
1178-
VerseRef = new VerseRefData(bookNum, c, 1)
1179-
}
1178+
VerseRef = new VerseRefData(bookNum, c, 1),
1179+
},
11801180
}
11811181
);
11821182
}

src/Migrations/PtdaSyncAll.Tests/SyncAllServiceTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,18 @@ public TestEnvironment()
347347
ParatextTokens = new Tokens
348348
{
349349
AccessToken = CreateAccessToken(DateTime.Now),
350-
RefreshToken = "test_refresh_token1"
351-
}
350+
RefreshToken = "test_refresh_token1",
351+
},
352352
},
353353
new UserSecret
354354
{
355355
Id = "user03",
356356
ParatextTokens = new Tokens
357357
{
358358
AccessToken = CreateAccessToken(DateTime.Now),
359-
RefreshToken = "test_refresh_token2"
360-
}
361-
}
359+
RefreshToken = "test_refresh_token2",
360+
},
361+
},
362362
}
363363
);
364364

@@ -426,7 +426,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
426426
{
427427
new User { Id = "user01", ParatextId = "pt01" },
428428
new User { Id = "user02", ParatextId = "pt02" },
429-
new User { Id = "user03", ParatextId = "pt03" }
429+
new User { Id = "user03", ParatextId = "pt03" },
430430
}
431431
)
432432
);
@@ -445,7 +445,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
445445
{
446446
{ "user01", SFProjectRole.Administrator },
447447
{ "user02", SFProjectRole.Translator },
448-
{ "user03", SFProjectRole.Administrator }
448+
{ "user03", SFProjectRole.Administrator },
449449
},
450450
ParatextId = "target",
451451
TranslateConfig = new TranslateConfig
@@ -456,11 +456,11 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
456456
ParatextId = "source",
457457
Name = "Source",
458458
ShortName = "SRC",
459-
WritingSystem = new WritingSystem { Tag = "en" }
460-
}
459+
WritingSystem = new WritingSystem { Tag = "en" },
460+
},
461461
},
462462
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
463-
Sync = new Sync { QueuedCount = 1 }
463+
Sync = new Sync { QueuedCount = 1 },
464464
},
465465
new SFProject
466466
{
@@ -471,7 +471,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
471471
{
472472
{ "user01", SFProjectRole.Administrator },
473473
{ "user02", SFProjectRole.Translator },
474-
{ "user03", SFProjectRole.Administrator }
474+
{ "user03", SFProjectRole.Administrator },
475475
},
476476
ParatextId = "target",
477477
TranslateConfig = new TranslateConfig
@@ -482,12 +482,12 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
482482
ParatextId = "source",
483483
Name = "Source",
484484
ShortName = "SR2",
485-
WritingSystem = new WritingSystem { Tag = "en" }
486-
}
485+
WritingSystem = new WritingSystem { Tag = "en" },
486+
},
487487
},
488488
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
489-
Sync = new Sync { QueuedCount = 1 }
490-
}
489+
Sync = new Sync { QueuedCount = 1 },
490+
},
491491
}
492492
)
493493
);
@@ -505,7 +505,7 @@ private string CreateAccessToken(DateTime issuedAt)
505505
new[]
506506
{
507507
new Claim(JwtClaimTypes.Subject, "paratext01"),
508-
new Claim(JwtClaimTypes.IssuedAt, EpochTime.GetIntDate(issuedAt).ToString())
508+
new Claim(JwtClaimTypes.IssuedAt, EpochTime.GetIntDate(issuedAt).ToString()),
509509
},
510510
expires: issuedAt + TimeSpan.FromMinutes(5)
511511
);

src/Migrations/PtdaSyncAll/PtdaSyncRunner.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ SortedList<int, IDocument<TextData>> dbChapterDocs
467467
Arguments = $"-u {tempOldUsxFile} {tempNewUsxFile}",
468468
UseShellExecute = false,
469469
CreateNoWindow = true,
470-
RedirectStandardOutput = true
471-
}
470+
RedirectStandardOutput = true,
471+
},
472472
}
473473
)
474474
{
@@ -545,7 +545,7 @@ Dictionary<int, ChapterDelta> incomingChapters
545545
{
546546
Number = incomingChapter.Key,
547547
LastVerse = incomingChapter.Value.LastVerse,
548-
IsValid = incomingChapter.Value.IsValid
548+
IsValid = incomingChapter.Value.IsValid,
549549
}
550550
);
551551
}
@@ -669,7 +669,7 @@ async Task createText(int chapterNum, Delta delta)
669669
{
670670
Number = kvp.Key,
671671
LastVerse = kvp.Value.LastVerse,
672-
IsValid = kvp.Value.IsValid
672+
IsValid = kvp.Value.IsValid,
673673
}
674674
);
675675
}

src/Migrations/SourceTargetSplitting/ObjectMigrator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ async Task createText(int chapterNum, Delta delta)
795795
{
796796
Number = kvp.Key,
797797
LastVerse = kvp.Value.LastVerse,
798-
IsValid = kvp.Value.IsValid
798+
IsValid = kvp.Value.IsValid,
799799
}
800800
);
801801
}

0 commit comments

Comments
 (0)