Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CSharpier to 0.30.3 #2912

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.28.2",
"version": "0.30.3",
"commands": ["dotnet-csharpier"],
"rollForward": false
}
Expand Down
10 changes: 5 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_prefer_system_threading_lock = true:suggestion

[*.{cs,vb}]
tab_width = 4
Expand Down Expand Up @@ -174,7 +175,7 @@ dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
dotnet_style_prefer_collection_expression = true:suggestion
dotnet_style_prefer_collection_expression = when_types_exactly_match:warning
dotnet_sort_system_directives_first = true

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

# Downgrade the following code style diagnostic messages so dotnet format does not fix them automatically.]]
# NOTE: Consider changing to warning when migrating from .NET 6.
# The following diagnostic is automatically fixed in .NET SDK 7.0.304 or higher - older versions will cause variance.
dotnet_diagnostic.IDE0270.severity = suggestion # Null check can be simplified
# This rule conflicts with CSharpier
# See https://csharpier.com/docs/IntegratingWithLinters
dotnet_diagnostic.IDE0055.severity = none
4 changes: 2 additions & 2 deletions src/Help/UpdateHelp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static void Main(string[] args)
{
{ "es", "9f727aa1dd179dd6d" },
{ "fr", "7da597faaebed6cc7" },
{ "pt_BR", "40bf11d4080246d99" }
{ "pt_BR", "40bf11d4080246d99" },
};

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

string[] htmlFiles = Directory.GetFiles(targetPath, "*.htm", SearchOption.AllDirectories);
// auxiliary html files with titles or headings that can be ignored
string[] ignoreFiles = { "index1.htm", "csh-redirect.htm" };
string[] ignoreFiles = ["index1.htm", "csh-redirect.htm"];
IEnumerable<string> targetFiles = htmlFiles.Where(t => !ignoreFiles.Contains(Path.GetFileName(t)));
foreach (string file in targetFiles)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Migrations/BackoutCommits/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ private static async Task<string> RunCommandAsync(string program, string argumen
Arguments = arguments,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
RedirectStandardError = true,
};
process.Start();
while (!process.HasExited)
Expand Down
30 changes: 15 additions & 15 deletions src/Migrations/PTDDCloneAll.Tests/CloneAllServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@ public TestEnvironment()
ParatextTokens = new Tokens
{
AccessToken = "test_access_token1",
RefreshToken = "test_refresh_token1"
}
RefreshToken = "test_refresh_token1",
},
},
new UserSecret
{
Id = "user03",
ParatextTokens = new Tokens
{
AccessToken = "test_access_token2",
RefreshToken = "test_refresh_token2"
}
}
RefreshToken = "test_refresh_token2",
},
},
}
);

Expand Down Expand Up @@ -131,7 +131,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
{
new User { Id = "user01", ParatextId = "pt01" },
new User { Id = "user02", ParatextId = "pt02" },
new User { Id = "user03", ParatextId = "pt03" }
new User { Id = "user03", ParatextId = "pt03" },
}
)
);
Expand All @@ -150,7 +150,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
{
{ "user01", SFProjectRole.Administrator },
{ "user02", SFProjectRole.Translator },
{ "user03", SFProjectRole.Administrator }
{ "user03", SFProjectRole.Administrator },
},
ParatextId = "target01",
TranslateConfig = new TranslateConfig
Expand All @@ -161,11 +161,11 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
ParatextId = "source01",
Name = "Source",
ShortName = "SRC",
WritingSystem = new WritingSystem { Tag = "en" }
}
WritingSystem = new WritingSystem { Tag = "en" },
},
},
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
Sync = new Sync { QueuedCount = 1 }
Sync = new Sync { QueuedCount = 1 },
},
new SFProject
{
Expand All @@ -176,7 +176,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
{
{ "user01", SFProjectRole.Administrator },
{ "user02", SFProjectRole.Translator },
{ "user03", SFProjectRole.Administrator }
{ "user03", SFProjectRole.Administrator },
},
ParatextId = "target02",
TranslateConfig = new TranslateConfig
Expand All @@ -187,12 +187,12 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
ParatextId = "source02",
Name = "Source",
ShortName = "SR2",
WritingSystem = new WritingSystem { Tag = "en" }
}
WritingSystem = new WritingSystem { Tag = "en" },
},
},
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
Sync = new Sync { QueuedCount = 1 }
}
Sync = new Sync { QueuedCount = 1 },
},
}
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Migrations/PTDDCloneAll/PTDDSyncRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ async Task createText(int chapterNum, Delta delta)
Number = kvp.Key,
LastVerse = kvp.Value.LastVerse,
IsValid = kvp.Value.IsValid,
Permissions = { }
Permissions = { },
}
);
}
Expand Down
28 changes: 14 additions & 14 deletions src/Migrations/PtdaSyncAll.Tests/PtdaSyncRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ public async Task SyncAsync_TextDocAlreadyExists()
.Add(
new TextData(Delta.New().InsertText("old text"))
{
Id = TextData.GetTextDocId("project01", 42, 1, TextType.Target)
Id = TextData.GetTextDocId("project01", 42, 1, TextType.Target),
}
);
env.SetupPTData(new Book("MAT", 2), new Book("MRK", 2), new Book("LUK", 2));
Expand Down Expand Up @@ -529,7 +529,7 @@ public async Task SyncBookUSxAsync_InvalidBookStateAndNoTextData_SkipSync()
Book matBook = new Book("MAT", 3, 3)
{
MissingTargetChapters = { 1, 2, 3 },
MissingSourceChapters = { 1, 2, 3 }
MissingSourceChapters = { 1, 2, 3 },
};
env.SetupSFData(true, true, false, matBook);
env.SetupPTData(new Book("MAT", 3, true));
Expand Down Expand Up @@ -762,7 +762,7 @@ public async Task ChangeDbToNewSnapshotAsync_Works()
var book = new Book("MAT", numberChapters, true)
{
MissingTargetChapters = missingDbChapters,
MissingSourceChapters = missingDbChapters
MissingSourceChapters = missingDbChapters,
};
env.SetupSFData(true, true, false, book);

Expand Down Expand Up @@ -847,7 +847,7 @@ public TestEnvironment()
var ptUserRoles = new Dictionary<string, string>
{
{ "pt01", SFProjectRole.Administrator },
{ "pt02", SFProjectRole.Translator }
{ "pt02", SFProjectRole.Translator },
};
ParatextService
.GetProjectRolesAsync(Arg.Any<UserSecret>(), "target")
Expand Down Expand Up @@ -930,7 +930,7 @@ params Book[] books
new[]
{
new User { Id = "user01", ParatextId = "pt01" },
new User { Id = "user02", ParatextId = "pt02" }
new User { Id = "user02", ParatextId = "pt02" },
}
)
);
Expand All @@ -948,7 +948,7 @@ params Book[] books
UserRoles = new Dictionary<string, string>
{
{ "user01", SFProjectRole.Administrator },
{ "user02", SFProjectRole.Translator }
{ "user02", SFProjectRole.Translator },
},
ParatextId = "target",
TranslateConfig = new TranslateConfig
Expand All @@ -959,13 +959,13 @@ params Book[] books
ParatextId = "source",
Name = "Source",
ShortName = "SRC",
WritingSystem = new WritingSystem { Tag = "en" }
}
WritingSystem = new WritingSystem { Tag = "en" },
},
},
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
Texts = books.Select(b => TextInfoFromBook(b)).ToList(),
Sync = new Sync { QueuedCount = 1 }
}
Sync = new Sync { QueuedCount = 1 },
},
}
)
);
Expand Down Expand Up @@ -1022,10 +1022,10 @@ public TextInfo TextInfoFromBook(Book book)
{
Number = c,
LastVerse = 10,
IsValid = !book.InvalidChapters.Contains(c)
IsValid = !book.InvalidChapters.Contains(c),
})
.ToList(),
HasSource = book.HighestSourceChapter > 0
HasSource = book.HighestSourceChapter > 0,
};
}

Expand Down Expand Up @@ -1175,8 +1175,8 @@ private void AddSFBook(
Id = $"project01:question{bookId}{c}",
DataId = $"question{bookId}{c}",
ProjectRef = "project01",
VerseRef = new VerseRefData(bookNum, c, 1)
}
VerseRef = new VerseRefData(bookNum, c, 1),
},
}
);
}
Expand Down
32 changes: 16 additions & 16 deletions src/Migrations/PtdaSyncAll.Tests/SyncAllServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,18 @@ public TestEnvironment()
ParatextTokens = new Tokens
{
AccessToken = CreateAccessToken(DateTime.Now),
RefreshToken = "test_refresh_token1"
}
RefreshToken = "test_refresh_token1",
},
},
new UserSecret
{
Id = "user03",
ParatextTokens = new Tokens
{
AccessToken = CreateAccessToken(DateTime.Now),
RefreshToken = "test_refresh_token2"
}
}
RefreshToken = "test_refresh_token2",
},
},
}
);

Expand Down Expand Up @@ -426,7 +426,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
{
new User { Id = "user01", ParatextId = "pt01" },
new User { Id = "user02", ParatextId = "pt02" },
new User { Id = "user03", ParatextId = "pt03" }
new User { Id = "user03", ParatextId = "pt03" },
}
)
);
Expand All @@ -445,7 +445,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
{
{ "user01", SFProjectRole.Administrator },
{ "user02", SFProjectRole.Translator },
{ "user03", SFProjectRole.Administrator }
{ "user03", SFProjectRole.Administrator },
},
ParatextId = "target",
TranslateConfig = new TranslateConfig
Expand All @@ -456,11 +456,11 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
ParatextId = "source",
Name = "Source",
ShortName = "SRC",
WritingSystem = new WritingSystem { Tag = "en" }
}
WritingSystem = new WritingSystem { Tag = "en" },
},
},
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
Sync = new Sync { QueuedCount = 1 }
Sync = new Sync { QueuedCount = 1 },
},
new SFProject
{
Expand All @@ -471,7 +471,7 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
{
{ "user01", SFProjectRole.Administrator },
{ "user02", SFProjectRole.Translator },
{ "user03", SFProjectRole.Administrator }
{ "user03", SFProjectRole.Administrator },
},
ParatextId = "target",
TranslateConfig = new TranslateConfig
Expand All @@ -482,12 +482,12 @@ public void SetupSFData(bool translationSuggestionsEnabled, bool checkingEnabled
ParatextId = "source",
Name = "Source",
ShortName = "SR2",
WritingSystem = new WritingSystem { Tag = "en" }
}
WritingSystem = new WritingSystem { Tag = "en" },
},
},
CheckingConfig = new CheckingConfig { CheckingEnabled = checkingEnabled },
Sync = new Sync { QueuedCount = 1 }
}
Sync = new Sync { QueuedCount = 1 },
},
}
)
);
Expand All @@ -505,7 +505,7 @@ private string CreateAccessToken(DateTime issuedAt)
new[]
{
new Claim(JwtClaimTypes.Subject, "paratext01"),
new Claim(JwtClaimTypes.IssuedAt, EpochTime.GetIntDate(issuedAt).ToString())
new Claim(JwtClaimTypes.IssuedAt, EpochTime.GetIntDate(issuedAt).ToString()),
},
expires: issuedAt + TimeSpan.FromMinutes(5)
);
Expand Down
8 changes: 4 additions & 4 deletions src/Migrations/PtdaSyncAll/PtdaSyncRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ SortedList<int, IDocument<TextData>> dbChapterDocs
Arguments = $"-u {tempOldUsxFile} {tempNewUsxFile}",
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true
}
RedirectStandardOutput = true,
},
}
)
{
Expand Down Expand Up @@ -545,7 +545,7 @@ Dictionary<int, ChapterDelta> incomingChapters
{
Number = incomingChapter.Key,
LastVerse = incomingChapter.Value.LastVerse,
IsValid = incomingChapter.Value.IsValid
IsValid = incomingChapter.Value.IsValid,
}
);
}
Expand Down Expand Up @@ -669,7 +669,7 @@ async Task createText(int chapterNum, Delta delta)
{
Number = kvp.Key,
LastVerse = kvp.Value.LastVerse,
IsValid = kvp.Value.IsValid
IsValid = kvp.Value.IsValid,
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Migrations/SourceTargetSplitting/ObjectMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ async Task createText(int chapterNum, Delta delta)
{
Number = kvp.Key,
LastVerse = kvp.Value.LastVerse,
IsValid = kvp.Value.IsValid
IsValid = kvp.Value.IsValid,
}
);
}
Expand Down
Loading
Loading