From 5ae36c3db88e52e4eb1c3489f2c028e79ea24481 Mon Sep 17 00:00:00 2001 From: forest93 Date: Fri, 30 Aug 2024 23:17:16 +0800 Subject: [PATCH] Fix styling. --- .../ConsoleTestApplication1.csproj | 2 +- Samples/ConsoleTestApplication1/Program.cs | 8 ++--- Samples/LinqToCargo/Program.cs | 4 +-- UnitTestProject1/Attributes.cs | 2 +- UnitTestProject1/Fixtures/WikiSiteProvider.cs | 4 +-- UnitTestProject1/GlobalSuppressions.cs | 10 ++++--- UnitTestProject1/Tests/GeneratorTests2.cs | 8 ++--- UnitTestProject1/Tests/InfrastructureTests.cs | 4 +-- UnitTestProject1/Tests/PageTests.cs | 6 ++-- UnitTestProject1/Tests/RenderingTests.cs | 4 +-- UnitTestProject1/Tests/SiteTokenTests.cs | 2 +- UnitTestProject1/Tests/WikiaApiTests.cs | 2 +- UnitTestProject1/Tests/WikibaseTests.cs | 2 +- UnitTestProject1/UnitTestProject1.csproj | 8 ++--- .../CargoPreEvaluationTranslator.cs | 2 +- .../CargoQueryClauseBuilder.cs | 2 +- .../CargoQueryExpressionReducer.cs | 2 +- .../ExpressionEqualityComparer.cs | 2 +- .../ExpressionVisitorUtility.cs | 2 +- WikiClientLibrary.Flow/Enums.cs | 6 ++-- WikiClientLibrary.Flow/FlowRequestHelper.cs | 4 +-- WikiClientLibrary.Wikia/Discussions/Post.cs | 2 +- WikiClientLibrary.Wikia/RequestHelper.cs | 4 +-- WikiClientLibrary.Wikia/Sites/WikiaSite.cs | 2 +- WikiClientLibrary.Wikia/Utility.cs | 2 +- .../WikiaApi/LocalWikiSearchList.cs | 4 +-- WikiClientLibrary.Wikibase/Claim.cs | 8 ++--- .../DataTypes/WbTime.cs | 4 +-- .../DataTypes/WikibaseDataType.cs | 4 +-- WikiClientLibrary.Wikibase/Entity.Editing.cs | 4 +-- WikiClientLibrary.Wikibase/Entity.cs | 2 +- .../SerializableEntity.cs | 8 ++--- WikiClientLibrary/Client/WikiClient.cs | 2 +- .../Files/ChunkedUploadSource.cs | 2 +- WikiClientLibrary/Files/UploadResult.cs | 4 +-- .../Generators/BacklinksGenerator.cs | 2 +- .../Generators/CategoryMembersGenerator.cs | 2 +- .../Generators/FileUsageGenerator.cs | 2 +- .../Generators/FilesGenerator.cs | 2 +- .../Generators/LinksGenerator.cs | 2 +- WikiClientLibrary/Generators/LogEventsList.cs | 20 ++++++------- .../Generators/Primitive/WikiList.cs | 2 +- .../Generators/RecentChangeItem.cs | 29 +++++++++---------- .../Generators/RecentChangesGenerator.cs | 4 +-- .../Generators/SearchGenerator.cs | 6 ++-- .../Generators/TranscludedInGenerator.cs | 2 +- .../Generators/TransclusionsGenerator.cs | 2 +- .../AsyncInitializationHelper.cs | 2 +- .../Logging/WikiLoggingHelper.cs | 2 +- .../Infrastructures/TokensManager.cs | 4 +-- WikiClientLibrary/MediaWikiVersion.cs | 2 +- .../Properties/CategoriesPropertyProvider.cs | 2 +- .../Properties/FileInfoPropertyProvider.cs | 4 +-- .../GeoCoordinatesPropertyProvider.cs | 2 +- .../Properties/PageImagesPropertyProvider.cs | 2 +- .../PagePropertiesPropertyProvider.cs | 2 +- .../Properties/RevisionsPropertyProvider.cs | 2 +- .../Pages/Queries/WikiPageQueryProvider.cs | 4 +-- WikiClientLibrary/Pages/WikiPageStub.cs | 2 +- WikiClientLibrary/RequestHelper.cs | 2 +- .../Scribunto/ScribuntoConsole.cs | 4 +-- WikiClientLibrary/Sites/SiteInfo.cs | 2 +- WikiClientLibrary/Sites/SiteOptions.cs | 2 +- WikiClientLibrary/Sites/WikiSite.Query.cs | 4 +-- WikiClientLibrary/Sites/WikiSite.cs | 2 +- WikiClientLibrary/UserStub.cs | 2 +- WikiClientLibrary/Utility.cs | 4 +-- WikiClientLibrary/WikiClientLibrary.csproj | 2 +- WikiClientLibrary/WikiLink.cs | 2 +- 69 files changed, 134 insertions(+), 135 deletions(-) diff --git a/Samples/ConsoleTestApplication1/ConsoleTestApplication1.csproj b/Samples/ConsoleTestApplication1/ConsoleTestApplication1.csproj index 748f74bf3..a214bec77 100644 --- a/Samples/ConsoleTestApplication1/ConsoleTestApplication1.csproj +++ b/Samples/ConsoleTestApplication1/ConsoleTestApplication1.csproj @@ -9,7 +9,7 @@ - + diff --git a/Samples/ConsoleTestApplication1/Program.cs b/Samples/ConsoleTestApplication1/Program.cs index f776112e2..d85b6c07c 100644 --- a/Samples/ConsoleTestApplication1/Program.cs +++ b/Samples/ConsoleTestApplication1/Program.cs @@ -40,7 +40,7 @@ static async Task HelloWikiWorld() // Create a MediaWiki Site instance with the URL of API endpoint. var site = new WikiSite(wikiClient, "https://test2.wikipedia.org/w/api.php") { - Logger = loggerFactory.CreateLogger() + Logger = loggerFactory.CreateLogger(), }; // Waits for the WikiSite to initialize await site.Initialization; @@ -114,7 +114,7 @@ static async Task HelloWikiGenerators() var allpages = new AllPagesGenerator(site) { StartTitle = "Wiki", - RedirectsFilter = PropertyFilterOption.WithoutProperty + RedirectsFilter = PropertyFilterOption.WithoutProperty, }; // Take the first 1000 results var pages = await allpages.EnumPagesAsync().Take(1000).ToListAsync(); @@ -126,7 +126,7 @@ static async Task HelloWikiGenerators() Console.WriteLine("Cats"); var catmembers = new CategoryMembersGenerator(site, "Category:Cats") { - MemberTypes = CategoryMemberTypes.Subcategory + MemberTypes = CategoryMemberTypes.Subcategory, }; pages = await catmembers.EnumPagesAsync().Take(10).ToListAsync(); foreach (var p in pages) @@ -175,7 +175,7 @@ static async Task InteractivePatrol() { TypeFilters = RecentChangesFilterTypes.Create, PaginationSize = 5, - PatrolledFilter = PropertyFilterOption.WithoutProperty + PatrolledFilter = PropertyFilterOption.WithoutProperty, }; // List the first unpatrolled result. var rc = await rcg.EnumItemsAsync().FirstOrDefaultAsync(); diff --git a/Samples/LinqToCargo/Program.cs b/Samples/LinqToCargo/Program.cs index 799c31d10..ef01c6026 100644 --- a/Samples/LinqToCargo/Program.cs +++ b/Samples/LinqToCargo/Program.cs @@ -18,7 +18,7 @@ using var client = new WikiClient { ClientUserAgent = "WikiClientLibrary.Samples.CargoLinq/1.0", - Logger = loggerFactory.CreateLogger() + Logger = loggerFactory.CreateLogger(), }; var site = new WikiSite(client, "https://lol.fandom.com/api.php"); site.Logger = loggerFactory.CreateLogger(); @@ -41,7 +41,7 @@ x.Direction, Roles = string.Join(';', x.Roles), Tags = string.Join(';', x.Tags), - Tournaments = string.Join(';', x.Tournaments) + Tournaments = string.Join(';', x.Tournaments), }); var counter = 0; await foreach (var item in query) diff --git a/UnitTestProject1/Attributes.cs b/UnitTestProject1/Attributes.cs index fd7c0ff1e..c629f84b2 100644 --- a/UnitTestProject1/Attributes.cs +++ b/UnitTestProject1/Attributes.cs @@ -9,7 +9,7 @@ public enum CISkippedReason Unknown = 0, Unstable, Deprecated, - AgentBlocked + AgentBlocked, } diff --git a/UnitTestProject1/Fixtures/WikiSiteProvider.cs b/UnitTestProject1/Fixtures/WikiSiteProvider.cs index 71c79d2c9..f98dc5c47 100644 --- a/UnitTestProject1/Fixtures/WikiSiteProvider.cs +++ b/UnitTestProject1/Fixtures/WikiSiteProvider.cs @@ -92,12 +92,12 @@ public async Task CreateWikiSiteAsync(IWikiClient wikiClient, string u { var uri = new Uri(url, UriKind.Absolute); var rootUrl = new Uri(uri, ".").ToString(); - var options = new WikiaSiteOptions(rootUrl) { AccountAssertion = AccountAssertionBehavior.AssertAll, }; + var options = new WikiaSiteOptions(rootUrl) { AccountAssertion = AccountAssertionBehavior.AssertAll }; site = new WikiaSite(wikiClient, options) { Logger = loggerFactory.CreateLogger() }; } else { - var options = new SiteOptions(url) { AccountAssertion = AccountAssertionBehavior.AssertAll, }; + var options = new SiteOptions(url) { AccountAssertion = AccountAssertionBehavior.AssertAll }; site = new WikiSite(wikiClient, options) { Logger = loggerFactory.CreateLogger() }; } await site.Initialization; diff --git a/UnitTestProject1/GlobalSuppressions.cs b/UnitTestProject1/GlobalSuppressions.cs index d800a502a..3dad5c7dd 100644 --- a/UnitTestProject1/GlobalSuppressions.cs +++ b/UnitTestProject1/GlobalSuppressions.cs @@ -7,7 +7,9 @@ using System.Diagnostics.CodeAnalysis; -[assembly: - SuppressMessage("Style", "VSTHRD200:Use Async suffix for async methods", Justification = "test methods", - Scope = "namespaceanddescendants", Target = "~N:WikiClientLibrary.Tests.UnitTestProject1.Tests") -] +[assembly: SuppressMessage("Style", "VSTHRD003:Avoid awaiting or returning a Task representing work that was not started within your context as that can lead to deadlocks.", + Justification = "There is no STA thread so what are you talking about? ", + Scope = "namespaceanddescendants", Target = "~N:WikiClientLibrary.Tests.UnitTestProject1.Tests")] +[assembly: SuppressMessage("Style", "VSTHRD200:Use Async suffix for async methods", + Justification = "test methods", + Scope = "namespaceanddescendants", Target = "~N:WikiClientLibrary.Tests.UnitTestProject1.Tests")] diff --git a/UnitTestProject1/Tests/GeneratorTests2.cs b/UnitTestProject1/Tests/GeneratorTests2.cs index fd39d6474..4029366a1 100644 --- a/UnitTestProject1/Tests/GeneratorTests2.cs +++ b/UnitTestProject1/Tests/GeneratorTests2.cs @@ -42,7 +42,7 @@ internal async Task WikiaLogEventsListLoopTest() // Introduce some last-resorts. generator.CompatibilityOptions = new WikiListCompatibilityOptions { - ContinuationLoopBehaviors = WikiListContinuationLoopBehaviors.FetchMore + ContinuationLoopBehaviors = WikiListContinuationLoopBehaviors.FetchMore, }; var logs2 = await generator.EnumItemsAsync().Take(100).ToListAsync(); Output.WriteLine("logs = {0}", string.Join(",", logs.Select(l => l.LogId))); @@ -107,7 +107,7 @@ public async Task RecentChangesGeneratorTest3(string siteName) var site = await WikiSiteFromNameAsync(siteName); var generator = new RecentChangesGenerator(site) { - LastRevisionsOnly = true, TypeFilters = RecentChangesFilterTypes.Edit, PaginationSize = 500 + LastRevisionsOnly = true, TypeFilters = RecentChangesFilterTypes.Edit, PaginationSize = 500, }; var pages = await generator.EnumPagesAsync().Take(2000).ToListAsync(); TracePages(pages); @@ -146,7 +146,7 @@ public async Task WpTest2PatrolTest1() var site = await WpTest2SiteAsync; var generator = new RecentChangesGenerator(site) { - LastRevisionsOnly = true, PatrolledFilter = PropertyFilterOption.WithoutProperty + LastRevisionsOnly = true, PatrolledFilter = PropertyFilterOption.WithoutProperty, }; var rc = await generator.EnumItemsAsync().Take(2).ToListAsync(); Output.WriteLine("Changes to patrol:"); @@ -170,7 +170,7 @@ public async Task LogEventsListTest1(string siteName) LogAction = LogActions.MoveOverRedirect, TimeAscending = false, // Local time should be converted to UTC in Utility.ToWikiQueryValue - StartTime = DateTime.Now - TimeSpan.FromDays(7) + StartTime = DateTime.Now - TimeSpan.FromDays(7), }; var logs = await generator.EnumItemsAsync().Take(200).ToListAsync(); ShallowTrace(logs, 1); diff --git a/UnitTestProject1/Tests/InfrastructureTests.cs b/UnitTestProject1/Tests/InfrastructureTests.cs index f22d0df9a..c9b63b8fa 100644 --- a/UnitTestProject1/Tests/InfrastructureTests.cs +++ b/UnitTestProject1/Tests/InfrastructureTests.cs @@ -40,9 +40,9 @@ public void JsonDataTimeTests() [Fact] public void WbMonolingualTextCollectionTest() { - var collection = new WbMonolingualTextCollection(new[] { new WbMonolingualText("en", "Wikipedia"), }) + var collection = new WbMonolingualTextCollection(new[] { new WbMonolingualText("en", "Wikipedia") }) { - { "zh-hans", "维基百科" }, { "zh-Hant", "維基百科" }, new WbMonolingualText("ja", "ウィキペディア") + { "zh-hans", "维基百科" }, { "zh-Hant", "維基百科" }, new WbMonolingualText("ja", "ウィキペディア"), }; collection["ru"] = "Википедия"; Assert.Equal(5, collection.Count); diff --git a/UnitTestProject1/Tests/PageTests.cs b/UnitTestProject1/Tests/PageTests.cs index 76bcf8092..74c97ca77 100644 --- a/UnitTestProject1/Tests/PageTests.cs +++ b/UnitTestProject1/Tests/PageTests.cs @@ -144,7 +144,7 @@ public async Task WpLzhPageExtractTest() var page = new WikiPage(site, "莎拉伯恩哈特"); await page.RefreshAsync(new WikiPageQueryProvider { - Properties = { new ExtractsPropertyProvider { AsPlainText = true, IntroductionOnly = true, MaxSentences = 1 } } + Properties = { new ExtractsPropertyProvider { AsPlainText = true, IntroductionOnly = true, MaxSentences = 1 } }, }); ShallowTrace(page); Assert.Equal("莎拉·伯恩哈特,一八四四年生,法國巴黎人也。", page.GetPropertyGroup()!.Extract); @@ -157,7 +157,7 @@ public async Task WpLzhPageImagesTest() var page = new WikiPage(site, "挪威"); await page.RefreshAsync(new WikiPageQueryProvider { - Properties = { new PageImagesPropertyProvider { QueryOriginalImage = true, ThumbnailSize = 100 } } + Properties = { new PageImagesPropertyProvider { QueryOriginalImage = true, ThumbnailSize = 100 } }, }); var group = page.GetPropertyGroup(); ShallowTrace(group); @@ -176,7 +176,7 @@ public async Task WpLzhPageLanguageLinksTest() var page = new WikiPage(site, "莎拉伯恩哈特"); await page.RefreshAsync(new WikiPageQueryProvider { - Properties = { new LanguageLinksPropertyProvider(LanguageLinkProperties.Autonym) } + Properties = { new LanguageLinksPropertyProvider(LanguageLinkProperties.Autonym) }, }); var langLinks = page.GetPropertyGroup()?.LanguageLinks; ShallowTrace(langLinks); diff --git a/UnitTestProject1/Tests/RenderingTests.cs b/UnitTestProject1/Tests/RenderingTests.cs index 7346c22a6..f747e6c61 100644 --- a/UnitTestProject1/Tests/RenderingTests.cs +++ b/UnitTestProject1/Tests/RenderingTests.cs @@ -25,8 +25,8 @@ public async Task WpLzhPageParsingTest1() Assert.Equal("一九五二年", result.Title); Assert.Matches(@"一九五二年", result.DisplayTitle); - Assert.True(result.LanguageLinks.First(l => l.Language == "en").Title == "1952"); - Assert.True(result.LanguageLinks.First(l => l.Language == "zh").Title == "1952年"); + Assert.Equal("1952", result.LanguageLinks.First(l => l.Language == "en").Title); + Assert.Equal("1952年", result.LanguageLinks.First(l => l.Language == "zh").Title); Assert.Contains(">公元一九五二年於諸曆 - - - - + + + + all runtime; build; native; contentfiles; analyzers diff --git a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoPreEvaluationTranslator.cs b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoPreEvaluationTranslator.cs index 7f81dcbe3..331bf2854 100644 --- a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoPreEvaluationTranslator.cs +++ b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoPreEvaluationTranslator.cs @@ -23,7 +23,7 @@ protected override Expression VisitMethodCall(MethodCallExpression node) node.Type), nameof(CargoFunctions.DateDiff) => new CargoFunctionExpression("DATEDIFF", typeof(int), Visit(node.Arguments[0]), Visit(node.Arguments[1])), - _ => throw new NotImplementedException($"CargoFunction call is not implemented: {node.Method}.") + _ => throw new NotImplementedException($"CargoFunction call is not implemented: {node.Method}."), }; } return base.VisitMethodCall(node); diff --git a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryClauseBuilder.cs b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryClauseBuilder.cs index 6e6fc8ce1..d8da01b90 100644 --- a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryClauseBuilder.cs +++ b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryClauseBuilder.cs @@ -33,7 +33,7 @@ internal class CargoQueryClauseBuilder : ExpressionVisitor { ExpressionType.Divide, " / " }, { ExpressionType.Modulo, " % " }, { ExpressionType.And, " & " }, - { ExpressionType.Or, " | " } + { ExpressionType.Or, " | " }, }; public string BuildClause(Expression expr) diff --git a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryExpressionReducer.cs b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryExpressionReducer.cs index db26ebd5a..c35725881 100644 --- a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryExpressionReducer.cs +++ b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/CargoQueryExpressionReducer.cs @@ -47,7 +47,7 @@ protected override Expression VisitMethodCall(MethodCallExpression node) UnwindLambdaExpression(Visit(node.Arguments[1])), true), nameof(Queryable.ThenByDescending) => ProcessThenOrderByCall((CargoQueryExpression)Visit(node.Arguments[0]), UnwindLambdaExpression(Visit(node.Arguments[1])), true), - _ => throw new NotSupportedException($"Queryable method call is not supported: {node.Method}.") + _ => throw new NotSupportedException($"Queryable method call is not supported: {node.Method}."), }; } return node; diff --git a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionEqualityComparer.cs b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionEqualityComparer.cs index c4cbae982..84989e8f8 100644 --- a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionEqualityComparer.cs +++ b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionEqualityComparer.cs @@ -41,7 +41,7 @@ public override int GetHashCode(Expression? obj) BinaryExpression be => HashCode.Combine(be.NodeType, GetHashCode(be.Left), GetHashCode(be.Right)), MemberExpression me => HashCode.Combine(me.NodeType, GetHashCode(me.Expression), me.Member, me.Type), null => 0, - _ => obj.GetHashCode() + _ => obj.GetHashCode(), }; } diff --git a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionVisitorUtility.cs b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionVisitorUtility.cs index 18131bcc5..640737276 100644 --- a/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionVisitorUtility.cs +++ b/WikiClientLibrary.Cargo/Linq/ExpressionVisitors/ExpressionVisitorUtility.cs @@ -13,7 +13,7 @@ public static LambdaExpression UnwindLambdaExpression(Expression lambdaOrQuote) LambdaExpression lambda => lambda, UnaryExpression unary when unary.Operand is LambdaExpression lambda1 && unary.NodeType == ExpressionType.Quote => lambda1, _ => throw new ArgumentException($"Provided expression cannot be unwound to LambdaExpression: {lambdaOrQuote}.", - nameof(lambdaOrQuote)) + nameof(lambdaOrQuote)), }; } diff --git a/WikiClientLibrary.Flow/Enums.cs b/WikiClientLibrary.Flow/Enums.cs index ccee64a9c..f67d9be96 100644 --- a/WikiClientLibrary.Flow/Enums.cs +++ b/WikiClientLibrary.Flow/Enums.cs @@ -64,7 +64,7 @@ public static string ToString(ModerationAction value) ModerationAction.Unhide => "unhide", ModerationAction.Undelete => "undelete", ModerationAction.Unsuppress => "unsuppress", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) + _ => throw new ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -74,7 +74,7 @@ public static string ToString(LockAction value) { LockAction.Lock => "lock", LockAction.Unlock => "unlock", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) + _ => throw new ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -85,7 +85,7 @@ public static ModerationState ParseModerationState(string value) "delete" => ModerationState.Deleted, "hide" => ModerationState.Hidden, "suppress" => ModerationState.Suppressed, - _ => ModerationState.Unknown + _ => ModerationState.Unknown, }; } diff --git a/WikiClientLibrary.Flow/FlowRequestHelper.cs b/WikiClientLibrary.Flow/FlowRequestHelper.cs index 729f10cbb..6ec8a365b 100644 --- a/WikiClientLibrary.Flow/FlowRequestHelper.cs +++ b/WikiClientLibrary.Flow/FlowRequestHelper.cs @@ -27,7 +27,7 @@ public static async Task ReplyAsync(WikiSite site, string pageTitle, strin token = WikiSiteToken.Edit, repreplyTo = workflowId, repformat = "wikitext", - repcontent = content + repcontent = content, }), cancellationToken); } var jtopic = jresult["flow"]["reply"]["committed"]?["topic"]; @@ -56,7 +56,7 @@ public static async Task NewTopicAsync(WikiSite site, string pageTitle, token = WikiSiteToken.Edit, nttopic = topicTitle, ntformat = "wikitext", - ntcontent = topicContent + ntcontent = topicContent, }), cancellationToken); } var jtopiclist = jresult["flow"]["new-topic"]?["committed"]?["topiclist"]; diff --git a/WikiClientLibrary.Wikia/Discussions/Post.cs b/WikiClientLibrary.Wikia/Discussions/Post.cs index c20e0b315..9108becd7 100644 --- a/WikiClientLibrary.Wikia/Discussions/Post.cs +++ b/WikiClientLibrary.Wikia/Discussions/Post.cs @@ -269,7 +269,7 @@ public enum PostQueryOptions /// If you are fetching for only 1 comment at a time, the exact authoring information /// will be fetching regardless of this flag. /// - ExactAuthoringInformation + ExactAuthoringInformation, } diff --git a/WikiClientLibrary.Wikia/RequestHelper.cs b/WikiClientLibrary.Wikia/RequestHelper.cs index d1e83cc47..77bda5bd0 100644 --- a/WikiClientLibrary.Wikia/RequestHelper.cs +++ b/WikiClientLibrary.Wikia/RequestHelper.cs @@ -69,7 +69,7 @@ IEnumerable PostsAndDescendants(IEnumerable posts) controller = "ArticleComments", method = "Content", articleId = board.Page.Id, - page = page + page = page, }), WikiaJsonResponseParser.Default, cancellationToken); // Build comment structure. var jcomments = jroot["commentListRaw"]?.AsObject(); @@ -88,7 +88,7 @@ IEnumerable PostsAndDescendants(IEnumerable posts) private static readonly WikiPageQueryProvider postLastRevisionQueryProvider = new WikiPageQueryProvider { - Properties = { new RevisionsPropertyProvider { FetchContent = true } }, ResolveRedirects = false + Properties = { new RevisionsPropertyProvider { FetchContent = true } }, ResolveRedirects = false, }; private static readonly RevisionsPropertyProvider postRevisionWithContentProvider = diff --git a/WikiClientLibrary.Wikia/Sites/WikiaSite.cs b/WikiClientLibrary.Wikia/Sites/WikiaSite.cs index 54dee2bc5..6ba98f326 100644 --- a/WikiClientLibrary.Wikia/Sites/WikiaSite.cs +++ b/WikiClientLibrary.Wikia/Sites/WikiaSite.cs @@ -77,7 +77,7 @@ public async Task InvokeWikiaAjaxAsync(WikiRequestMessage request, { var fields = new List>(queryRequest.Fields.Count + 1) { - new KeyValuePair("action", "ajax") + new KeyValuePair("action", "ajax"), }; fields.AddRange(queryRequest.Fields); localRequest = new WikiaQueryRequestMessage(request.Id, fields, queryRequest.UseHttpPost); diff --git a/WikiClientLibrary.Wikia/Utility.cs b/WikiClientLibrary.Wikia/Utility.cs index 8646d88b9..77778550c 100644 --- a/WikiClientLibrary.Wikia/Utility.cs +++ b/WikiClientLibrary.Wikia/Utility.cs @@ -8,7 +8,7 @@ internal static class Utility public static readonly JsonSerializerOptions WikiaApiJsonSerializerOptions = new() { - PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, Converters = { new WikiReadOnlyDictionaryConverterFactory(), } + PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower, Converters = { new WikiReadOnlyDictionaryConverterFactory() }, }; /// diff --git a/WikiClientLibrary.Wikia/WikiaApi/LocalWikiSearchList.cs b/WikiClientLibrary.Wikia/WikiaApi/LocalWikiSearchList.cs index 61c6f4d59..ba2f435d8 100644 --- a/WikiClientLibrary.Wikia/WikiaApi/LocalWikiSearchList.cs +++ b/WikiClientLibrary.Wikia/WikiaApi/LocalWikiSearchList.cs @@ -121,7 +121,7 @@ private string SerializeRank(SearchRankingType value) SearchRankingType.MostViewed => "most-viewed", SearchRankingType.Freshest => "freshest", SearchRankingType.Stalest => "stalest", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) + _ => throw new ArgumentOutOfRangeException(nameof(value), value, null), }; } @@ -161,6 +161,6 @@ public enum SearchRankingType Stable, MostViewed, Freshest, - Stalest + Stalest, } diff --git a/WikiClientLibrary.Wikibase/Claim.cs b/WikiClientLibrary.Wikibase/Claim.cs index c82324e7c..191696d55 100644 --- a/WikiClientLibrary.Wikibase/Claim.cs +++ b/WikiClientLibrary.Wikibase/Claim.cs @@ -209,7 +209,7 @@ internal Contracts.Reference ToContract() { Hash = Hash, Snaks = Claim.GroupIntoDictionary(Snaks.Select(s => s.ToContract()), s => s.Property), - SnaksOrder = Snaks.Select(s => s.PropertyId).Distinct().ToList() + SnaksOrder = Snaks.Select(s => s.PropertyId).Distinct().ToList(), }; } @@ -381,7 +381,7 @@ public override string ToString() SnakType.Value => DataValue?.ToString(), SnakType.SomeValue => "[SomeValue]", SnakType.NoValue => "[NoValue]", - _ => "[Invalid SnakType]" + _ => "[Invalid SnakType]", }; return $"{PropertyId} = {valueExpr}"; } @@ -394,7 +394,7 @@ internal static SnakType ParseSnakType(string expr) "value" => SnakType.Value, "somevalue" => SnakType.SomeValue, "novalue" => SnakType.NoValue, - _ => throw new ArgumentException("Invalid SnackType expression.", nameof(expr)) + _ => throw new ArgumentException("Invalid SnackType expression.", nameof(expr)), }; } @@ -405,7 +405,7 @@ internal static string ParseSnakType(SnakType value) SnakType.Value => "value", SnakType.SomeValue => "somevalue", SnakType.NoValue => "novalue", - _ => throw new ArgumentException("Invalid SnackType value.", nameof(value)) + _ => throw new ArgumentException("Invalid SnackType value.", nameof(value)), }; } diff --git a/WikiClientLibrary.Wikibase/DataTypes/WbTime.cs b/WikiClientLibrary.Wikibase/DataTypes/WbTime.cs index 70f7e82f8..12d533011 100644 --- a/WikiClientLibrary.Wikibase/DataTypes/WbTime.cs +++ b/WikiClientLibrary.Wikibase/DataTypes/WbTime.cs @@ -214,7 +214,7 @@ public override string ToString() WikibaseTimePrecision.Hour => $"{Year:0000}-{Month:00}-{Day:00} {Hour:00}h", WikibaseTimePrecision.Minute => $"{Year:0000}-{Month:00}-{Day:00} {Hour:00}:{Minute:00}", WikibaseTimePrecision.Second => $"{Year:0000}-{Month:00}-{Day:00} {Hour:00}:{Minute:00}:{Second:00}", - _ => "Y" + Year + _ => "Y" + Year, }; } @@ -354,6 +354,6 @@ public enum WikibaseTimePrecision Minute = 13, /// Seconds. - Second = 14 + Second = 14, } diff --git a/WikiClientLibrary.Wikibase/DataTypes/WikibaseDataType.cs b/WikiClientLibrary.Wikibase/DataTypes/WikibaseDataType.cs index a7f642da6..e3f1b9e1c 100644 --- a/WikiClientLibrary.Wikibase/DataTypes/WikibaseDataType.cs +++ b/WikiClientLibrary.Wikibase/DataTypes/WikibaseDataType.cs @@ -168,7 +168,7 @@ private static string EntityIdFromJson(JsonNode value) { "item" => "Q", "property" => "P", - _ => throw new ArgumentException($"Invalid entity-type: {type}.", nameof(value)) + _ => throw new ArgumentException($"Invalid entity-type: {type}.", nameof(value)), }; id += (string)value["numeric-id"]; return id; @@ -274,7 +274,7 @@ private static JsonNode EntityIdToJson(string id) { "before", v.Before }, { "after", v.After }, { "precision", (int)v.Precision }, - { "calendarmodel", v.CalendarModel.ToString() } + { "calendarmodel", v.CalendarModel.ToString() }, }; return obj; }); diff --git a/WikiClientLibrary.Wikibase/Entity.Editing.cs b/WikiClientLibrary.Wikibase/Entity.Editing.cs index 5b123578a..5cbd5aebb 100644 --- a/WikiClientLibrary.Wikibase/Entity.Editing.cs +++ b/WikiClientLibrary.Wikibase/Entity.Editing.cs @@ -131,7 +131,7 @@ private static string FormatEntityType(EntityType type) { EntityType.Item => "item", EntityType.Property => "property", - _ => throw new ArgumentException("Invalid entity type.", nameof(type)) + _ => throw new ArgumentException("Invalid entity type.", nameof(type)), }; } @@ -470,6 +470,6 @@ public enum EntityEditOptions /// instead of only checking for conflict before sending the first API request. /// When this flag is set, if other user edited the same entity as the one performing progressive edit, /// an will be thrown. - StrictEditConflictDetection + StrictEditConflictDetection, } diff --git a/WikiClientLibrary.Wikibase/Entity.cs b/WikiClientLibrary.Wikibase/Entity.cs index 28b5763bf..c2bf696e4 100644 --- a/WikiClientLibrary.Wikibase/Entity.cs +++ b/WikiClientLibrary.Wikibase/Entity.cs @@ -407,7 +407,7 @@ public EntitySiteLink(string site, string title, IEnumerable? badges, st { null => ImmutableList.Empty, IImmutableList imBadges => imBadges, - var b => b.ToImmutableList() + var b => b.ToImmutableList(), }; Url = url; } diff --git a/WikiClientLibrary.Wikibase/SerializableEntity.cs b/WikiClientLibrary.Wikibase/SerializableEntity.cs index b22c4e5d1..f989e2a59 100644 --- a/WikiClientLibrary.Wikibase/SerializableEntity.cs +++ b/WikiClientLibrary.Wikibase/SerializableEntity.cs @@ -111,7 +111,7 @@ internal static EntityType ParseEntityType(string? value) { "item" => EntityType.Item, "property" => EntityType.Property, - _ => EntityType.Unknown + _ => EntityType.Unknown, }; } @@ -121,7 +121,7 @@ private static string ToString(EntityType value) { EntityType.Item => "item", EntityType.Property => "property", - _ => "unknown" + _ => "unknown", }; } @@ -142,7 +142,7 @@ public static SerializableEntity Load(IEntity entity) Descriptions = new WbMonolingualTextCollection(entity.Descriptions), Labels = new WbMonolingualTextCollection(entity.Labels), Claims = new ClaimCollection(entity.Claims), - SiteLinks = new EntitySiteLinkCollection(entity.SiteLinks) + SiteLinks = new EntitySiteLinkCollection(entity.SiteLinks), }; return inst; } @@ -319,7 +319,7 @@ private Contracts.Entity ToContract() Sitelinks = SiteLinks.ToDictionary(link => link.Site, link => new Contracts.SiteLink { Site = link.Site, Title = link.Title, Badges = link.Badges.ToList() }), Claims = Claims.GroupBy(c => c.MainSnak.PropertyId).ToDictionary(g => g.Key, - g => (ICollection)g.Select(c => c.ToContract(false)).ToList()) + g => (ICollection)g.Select(c => c.ToContract(false)).ToList()), }; return obj; } diff --git a/WikiClientLibrary/Client/WikiClient.cs b/WikiClientLibrary/Client/WikiClient.cs index 19a1b1918..968eeafba 100644 --- a/WikiClientLibrary/Client/WikiClient.cs +++ b/WikiClientLibrary/Client/WikiClient.cs @@ -241,7 +241,7 @@ async Task PrepareForRetry(TimeSpan delay) { throw new HttpRequestException(ex1.Message + Prompts.ExceptionSecureChannelFailureHint, ex) { - HelpLink = MediaWikiHelper.ExceptionTroubleshootingHelpLink + HelpLink = MediaWikiHelper.ExceptionTroubleshootingHelpLink, }; } } diff --git a/WikiClientLibrary/Files/ChunkedUploadSource.cs b/WikiClientLibrary/Files/ChunkedUploadSource.cs index fc7e327b0..7def0868d 100644 --- a/WikiClientLibrary/Files/ChunkedUploadSource.cs +++ b/WikiClientLibrary/Files/ChunkedUploadSource.cs @@ -146,7 +146,7 @@ public override IEnumerable> GetUploadParameters(Si return new[] { new KeyValuePair( - siteInfo.Version >= v118 ? "filekey" : "sessionkey", FileKey) + siteInfo.Version >= v118 ? "filekey" : "sessionkey", FileKey), }; } diff --git a/WikiClientLibrary/Files/UploadResult.cs b/WikiClientLibrary/Files/UploadResult.cs index 67fdecfa9..876251eee 100644 --- a/WikiClientLibrary/Files/UploadResult.cs +++ b/WikiClientLibrary/Files/UploadResult.cs @@ -31,7 +31,7 @@ private string Result "Success" => UploadResultCode.Success, "Warning" => UploadResultCode.Warning, "Continue" => UploadResultCode.Continue, - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown result: " + value) + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown result: " + value), }; } } @@ -106,7 +106,7 @@ public enum UploadResultCode Success = 0, Warning, - Continue + Continue, } diff --git a/WikiClientLibrary/Generators/BacklinksGenerator.cs b/WikiClientLibrary/Generators/BacklinksGenerator.cs index b0e010e1e..8c17c42b1 100644 --- a/WikiClientLibrary/Generators/BacklinksGenerator.cs +++ b/WikiClientLibrary/Generators/BacklinksGenerator.cs @@ -75,7 +75,7 @@ public BacklinksGenerator(WikiSite site, string? targetTitle) : base(site) { "blnamespace", NamespaceIds == null ? null : MediaWikiHelper.JoinValues(NamespaceIds) }, { "blfilterredir", RedirectsFilter.ToString("redirects", "nonredirects") }, { "bllimit", actualPaginationSize }, - { "blredirect", AllowRedirectedLinks } + { "blredirect", AllowRedirectedLinks }, }; } diff --git a/WikiClientLibrary/Generators/CategoryMembersGenerator.cs b/WikiClientLibrary/Generators/CategoryMembersGenerator.cs index 926ac81f7..853c981fe 100644 --- a/WikiClientLibrary/Generators/CategoryMembersGenerator.cs +++ b/WikiClientLibrary/Generators/CategoryMembersGenerator.cs @@ -76,7 +76,7 @@ private string ParseMemberTypes(CategoryMemberTypes value) { "cmtitle", CategoryTitle }, { "cmlimit", PaginationSize }, { "cmnamespace", NamespaceIds == null ? null : MediaWikiHelper.JoinValues(NamespaceIds) }, - { "cmtype", ParseMemberTypes(MemberTypes) } + { "cmtype", ParseMemberTypes(MemberTypes) }, }; } diff --git a/WikiClientLibrary/Generators/FileUsageGenerator.cs b/WikiClientLibrary/Generators/FileUsageGenerator.cs index 60614f3a5..f0b7af7c9 100644 --- a/WikiClientLibrary/Generators/FileUsageGenerator.cs +++ b/WikiClientLibrary/Generators/FileUsageGenerator.cs @@ -52,7 +52,7 @@ public FileUsageGenerator(WikiSite site, string targetTitle) : base(site) { "iutitle", TargetTitle }, { "iunamespace", NamespaceIds == null ? null : MediaWikiHelper.JoinValues(NamespaceIds) }, { "iufilterredir", RedirectsFilter.ToString("redirects", "nonredirects") }, - { "iulimit", PaginationSize } + { "iulimit", PaginationSize }, }; } diff --git a/WikiClientLibrary/Generators/FilesGenerator.cs b/WikiClientLibrary/Generators/FilesGenerator.cs index b0d216dba..a608ea20e 100644 --- a/WikiClientLibrary/Generators/FilesGenerator.cs +++ b/WikiClientLibrary/Generators/FilesGenerator.cs @@ -48,7 +48,7 @@ public FilesGenerator(WikiSite site, WikiPageStub pageStub) : base(site, pageStu { { "imlimit", PaginationSize }, { "imimages", MatchingTitles == null ? null : MediaWikiHelper.JoinValues(MatchingTitles) }, - { "imdir", OrderDescending ? "descending" : "ascending" } + { "imdir", OrderDescending ? "descending" : "ascending" }, }; } diff --git a/WikiClientLibrary/Generators/LinksGenerator.cs b/WikiClientLibrary/Generators/LinksGenerator.cs index 131f15979..c57b8eb7c 100644 --- a/WikiClientLibrary/Generators/LinksGenerator.cs +++ b/WikiClientLibrary/Generators/LinksGenerator.cs @@ -55,7 +55,7 @@ public LinksGenerator(WikiSite site, WikiPageStub pageStub) : base(site, pageStu { "plnamespace", NamespaceIds == null ? null : MediaWikiHelper.JoinValues(NamespaceIds) }, { "pllimit", PaginationSize }, { "pltitles", MatchingTitles == null ? null : MediaWikiHelper.JoinValues(MatchingTitles) }, - { "pldir", OrderDescending ? "descending" : "ascending" } + { "pldir", OrderDescending ? "descending" : "ascending" }, }; } diff --git a/WikiClientLibrary/Generators/LogEventsList.cs b/WikiClientLibrary/Generators/LogEventsList.cs index 561531d35..0c54c8198 100644 --- a/WikiClientLibrary/Generators/LogEventsList.cs +++ b/WikiClientLibrary/Generators/LogEventsList.cs @@ -124,7 +124,7 @@ public string? LogAction { "letag", Tag }, { "letype", LogType }, { "leaction", fullLogAction }, - { "lelimit", PaginationSize } + { "lelimit", PaginationSize }, }; } @@ -192,7 +192,7 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) PageId = rc.PageId, ParsedComment = rc.ParsedComment, Tags = rc.Tags, - Title = rc.Title + Title = rc.Title, }; } @@ -202,7 +202,7 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) /// Full title of the page affected by this item. /// For user operation, this is the title user page of target user. - public string Title { get; init; } + public string? Title { get; init; } /// the page id at the time the log was stored. [JsonPropertyName("logpage")] @@ -210,7 +210,7 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) /// Name of the user making this recent change. [JsonPropertyName("user")] - public string UserName { get; init; } + public string? UserName { get; init; } /// The user ID who was responsible for the log event/recent change. /// @@ -229,10 +229,10 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) public DateTime TimeStamp { get; init; } /// The edit/log comment. - public string Comment { get; init; } + public string? Comment { get; init; } /// The parsed comment for the edit/log comment. - public string ParsedComment { get; init; } + public string? ParsedComment { get; init; } /// Tags for the event. public IList Tags { get; init; } @@ -242,7 +242,7 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) /// Gets log type name. /// See for a list of predefined values. - public string Type { get; init; } + public string? Type { get; init; } /// /// Specific log action. @@ -253,7 +253,7 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) /// property, because certain the same log action value may have different meaning in /// different log type context. /// - public string Action { get; init; } + public string? Action { get; init; } /// For log items, gets additional log parameters. /// @@ -264,7 +264,7 @@ internal static LogEventItem FromRecentChangeItem(RecentChangeItem rc) /// /// For modern MediaWiki builds, this property uses the value of `params` property. /// For compatibility with MediaWiki 1.19 and below, this property also tries to use the property - /// whose name is the value of . (e.g. use `move` property if is . + /// whose name is the value of . (e.g. use `move` property if is ). /// public LogParameterCollection Params { get; init; } = LogParameterCollection.Empty; @@ -510,7 +510,7 @@ public static class LogActions /// () For an anonymous user creating an account for himself. public const string Create = "create"; - /// () For a logged in user creating an account for someone else. + /// () For a logged-in user creating an account for someone else. public const string Create2 = "create2"; /// () For pages whose language has been changed. diff --git a/WikiClientLibrary/Generators/Primitive/WikiList.cs b/WikiClientLibrary/Generators/Primitive/WikiList.cs index 7290d8c56..0b574feba 100644 --- a/WikiClientLibrary/Generators/Primitive/WikiList.cs +++ b/WikiClientLibrary/Generators/Primitive/WikiList.cs @@ -138,7 +138,7 @@ protected virtual void OnEnumItemsFailed(Exception exception) /// public async IAsyncEnumerable EnumItemsAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) { - var baseQueryParams = new Dictionary { { "action", "query" }, { "maxlag", 5 }, { "list", ListName }, }; + var baseQueryParams = new Dictionary { { "action", "query" }, { "maxlag", 5 }, { "list", ListName } }; foreach (var p in EnumListParameters()) baseQueryParams.Add(p.Key, p.Value); cancellationToken.ThrowIfCancellationRequested(); diff --git a/WikiClientLibrary/Generators/RecentChangeItem.cs b/WikiClientLibrary/Generators/RecentChangeItem.cs index da95bb7ec..c82a05ca8 100644 --- a/WikiClientLibrary/Generators/RecentChangeItem.cs +++ b/WikiClientLibrary/Generators/RecentChangeItem.cs @@ -62,7 +62,7 @@ private string TypeName public int NamespaceId { get; init; } /// Full title of the page affected by this item. - public string Title { get; init; } + public string? Title { get; init; } /// ID of the page affected by this item. public long PageId { get; init; } @@ -81,7 +81,7 @@ private string TypeName /// Name of the user making this recent change. [JsonPropertyName("user")] - public string UserName { get; init; } + public string? UserName { get; init; } /// The user ID who was responsible for the recent change. /// When using this property with log events, there are some caveats. @@ -103,15 +103,15 @@ private string TypeName public DateTime TimeStamp { get; init; } /// The edit/log comment. - public string Comment { get; init; } + public string? Comment { get; init; } /// The parsed comment for the edit/log comment. - public string ParsedComment { get; init; } + public string? ParsedComment { get; init; } - public IList Tags { get; init; } + public IList Tags { get; init; } = Array.Empty(); /// SHA-1 hash of the updated revision. - public string Sha1 { get; init; } + public string? Sha1 { get; init; } public bool Redirect { get; init; } @@ -138,10 +138,10 @@ private string TypeName public LogParameterCollection LogParams { get; init; } = LogParameterCollection.Empty; [JsonIgnore] - public RevisionFlags Flags { get; private set; } + public RevisionFlags Flags { get; private init; } [JsonIgnore] - public PatrolStatus PatrolStatus { get; private set; } + public PatrolStatus PatrolStatus { get; private init; } [JsonInclude] private bool Minor @@ -198,7 +198,7 @@ internal void OnDeserialized(WikiSite s) /// /// /// You don't have permission to patrol changes. Only users with the patrol right can do this. - /// OR You don't have permission to patrol your own changes. Only users with the autopatrol right can do this. + /// OR You don't have permission to patrol your own changes. Only users with the autopatrol right can do this. /// /// It's suggested that the caller only patrol the pages whose is . /// Patrolling is disabled on this wiki. @@ -291,17 +291,14 @@ public enum RecentChangesType Move, Log, - /// - /// Category membership change. (MediaWiki 1.27) - /// + /// Category membership change. (MediaWiki 1.27+) /// See https://www.mediawiki.org/wiki/Manual:CategoryMembershipChanges . Categorize, External, - /// - /// Move over redirect. (Obsolete.) - /// - [Obsolete] MoveOverRedirect, + /// Move over redirect. (Obsolete.) + [Obsolete("The Recent Change type is obsolete as marked by the documentation.")] + MoveOverRedirect, } diff --git a/WikiClientLibrary/Generators/RecentChangesGenerator.cs b/WikiClientLibrary/Generators/RecentChangesGenerator.cs index 9b9b94161..75b337849 100644 --- a/WikiClientLibrary/Generators/RecentChangesGenerator.cs +++ b/WikiClientLibrary/Generators/RecentChangesGenerator.cs @@ -134,7 +134,7 @@ private string ParseRecentChangesTypes(RecentChangesFilterTypes value) { prefix + "rctype", ParseRecentChangesTypes(TypeFilters) }, { prefix + "rcshow", ParseFilters() }, { prefix + "rctoponly", LastRevisionsOnly }, - { prefix + "rclimit", PaginationSize } + { prefix + "rclimit", PaginationSize }, }; if (isList) { @@ -221,6 +221,6 @@ public enum RecentChangesFilterTypes /// /// All types of changes. /// - All = Edit | External | Create | Log | Categorize + All = Edit | External | Create | Log | Categorize, } diff --git a/WikiClientLibrary/Generators/SearchGenerator.cs b/WikiClientLibrary/Generators/SearchGenerator.cs index 812046137..fffdd3607 100644 --- a/WikiClientLibrary/Generators/SearchGenerator.cs +++ b/WikiClientLibrary/Generators/SearchGenerator.cs @@ -89,7 +89,7 @@ public SearchableField MatchingField { "srwhat", MatchingField }, { "srlimit", PaginationSize }, { "srinterwiki", IncludesInterwiki }, - { "srbackend", BackendName } + { "srbackend", BackendName }, }; // Include redirect pages in the search. From 1.23 onwards, redirects are always included. (Removed in 1.23) if (Site.SiteInfo.Version < new MediaWikiVersion(1, 23)) @@ -99,7 +99,7 @@ public SearchableField MatchingField SearchableField.Title => "title", SearchableField.Text => "text", SearchableField.NearMatch => "nearmatch", - _ => throw new ArgumentOutOfRangeException() + _ => throw new ArgumentOutOfRangeException(), }; return dict; } @@ -142,6 +142,6 @@ public enum SearchableField /// /// Search for a near match in the title. (MediaWiki 1.17+) /// - NearMatch + NearMatch, } diff --git a/WikiClientLibrary/Generators/TranscludedInGenerator.cs b/WikiClientLibrary/Generators/TranscludedInGenerator.cs index 061a8a37b..9e5810e77 100644 --- a/WikiClientLibrary/Generators/TranscludedInGenerator.cs +++ b/WikiClientLibrary/Generators/TranscludedInGenerator.cs @@ -52,7 +52,7 @@ public TranscludedInGenerator(WikiSite site, string targetTitle) : base(site) { "eititle", TargetTitle }, { "einamespace", NamespaceIds == null ? null : MediaWikiHelper.JoinValues(NamespaceIds) }, { "eifilterredir", RedirectsFilter.ToString("redirects", "nonredirects") }, - { "eilimit", PaginationSize } + { "eilimit", PaginationSize }, }; } diff --git a/WikiClientLibrary/Generators/TransclusionsGenerator.cs b/WikiClientLibrary/Generators/TransclusionsGenerator.cs index cb8533114..45d471912 100644 --- a/WikiClientLibrary/Generators/TransclusionsGenerator.cs +++ b/WikiClientLibrary/Generators/TransclusionsGenerator.cs @@ -54,7 +54,7 @@ public TransclusionsGenerator(WikiSite site, WikiPageStub pageStub) : base(site, { "tlnamespace", NamespaceIds == null ? null : MediaWikiHelper.JoinValues(NamespaceIds) }, { "tllimit", PaginationSize }, { "tltemplates", MatchingTitles == null ? null : MediaWikiHelper.JoinValues(MatchingTitles) }, - { "tldir", OrderDescending ? "descending" : "ascending" } + { "tldir", OrderDescending ? "descending" : "ascending" }, }; } diff --git a/WikiClientLibrary/Infrastructures/AsyncInitializationHelper.cs b/WikiClientLibrary/Infrastructures/AsyncInitializationHelper.cs index ac46cf40a..a20b618eb 100644 --- a/WikiClientLibrary/Infrastructures/AsyncInitializationHelper.cs +++ b/WikiClientLibrary/Infrastructures/AsyncInitializationHelper.cs @@ -35,7 +35,7 @@ public static void EnsureInitialized(Type objectType, Task initializationTask) TaskStatus.Faulted => new InvalidOperationException( string.Format(Prompts.ExceptionAsyncInitFaulted2, name, initializationTask.Exception), initializationTask.Exception), - _ => new InvalidOperationException(string.Format(Prompts.ExceptionAsyncInitNotComplete1, name)) + _ => new InvalidOperationException(string.Format(Prompts.ExceptionAsyncInitNotComplete1, name)), }; } diff --git a/WikiClientLibrary/Infrastructures/Logging/WikiLoggingHelper.cs b/WikiClientLibrary/Infrastructures/Logging/WikiLoggingHelper.cs index 1e5bd00f3..1632a4843 100644 --- a/WikiClientLibrary/Infrastructures/Logging/WikiLoggingHelper.cs +++ b/WikiClientLibrary/Infrastructures/Logging/WikiLoggingHelper.cs @@ -199,7 +199,7 @@ IEnumerator IEnumerable.GetEnumerator() 0 => new KeyValuePair("Target", target), 1 => new KeyValuePair("Action", action), 2 => new KeyValuePair("Parameters", parameters), - _ => throw new IndexOutOfRangeException() + _ => throw new IndexOutOfRangeException(), }; } } diff --git a/WikiClientLibrary/Infrastructures/TokensManager.cs b/WikiClientLibrary/Infrastructures/TokensManager.cs index 7c62b5850..f35e277d9 100644 --- a/WikiClientLibrary/Infrastructures/TokensManager.cs +++ b/WikiClientLibrary/Infrastructures/TokensManager.cs @@ -38,7 +38,7 @@ public TokensManager(WikiSite site) private async Task> FetchTokensAsync2(string tokenTypeExpr, CancellationToken cancellationToken) { var jobj = await site.InvokeMediaWikiApiAsync( - new MediaWikiFormRequestMessage(new { action = "query", meta = "tokens", type = tokenTypeExpr, }), true, cancellationToken); + new MediaWikiFormRequestMessage(new { action = "query", meta = "tokens", type = tokenTypeExpr }), true, cancellationToken); var warnings = jobj["warnings"]?["tokens"]; if (warnings != null) { @@ -182,7 +182,7 @@ list recentchanges. var jobj = await site.InvokeMediaWikiApiAsync( new MediaWikiFormRequestMessage(new { - action = "query", list = "recentchanges", rctoken = "patrol", rclimit = 1 + action = "query", list = "recentchanges", rctoken = "patrol", rclimit = 1, }), cts.Token); try { diff --git a/WikiClientLibrary/MediaWikiVersion.cs b/WikiClientLibrary/MediaWikiVersion.cs index f965a1ccf..a0804ea1e 100644 --- a/WikiClientLibrary/MediaWikiVersion.cs +++ b/WikiClientLibrary/MediaWikiVersion.cs @@ -36,7 +36,7 @@ public enum MediaWikiDevChannel /// /// Release candidate. Version suffix is -rc. /// - RC = 4 + RC = 4, } diff --git a/WikiClientLibrary/Pages/Queries/Properties/CategoriesPropertyProvider.cs b/WikiClientLibrary/Pages/Queries/Properties/CategoriesPropertyProvider.cs index 1aca217bc..d6eeb5946 100644 --- a/WikiClientLibrary/Pages/Queries/Properties/CategoriesPropertyProvider.cs +++ b/WikiClientLibrary/Pages/Queries/Properties/CategoriesPropertyProvider.cs @@ -24,7 +24,7 @@ public class CategoriesPropertyProvider : WikiPagePropertyProvider { - { "clprop", "sortkey|timestamp|hidden" }, { "clshow", HiddenCategoryFilter.ToString("hidden", "!hidden", null) } + { "clprop", "sortkey|timestamp|hidden" }, { "clshow", HiddenCategoryFilter.ToString("hidden", "!hidden", null) }, }; if (CategorySelection != null) p.Add("clcategories", MediaWikiHelper.JoinValues(CategorySelection)); return p; diff --git a/WikiClientLibrary/Pages/Queries/Properties/FileInfoPropertyProvider.cs b/WikiClientLibrary/Pages/Queries/Properties/FileInfoPropertyProvider.cs index 7c49ee33b..a66e16e57 100644 --- a/WikiClientLibrary/Pages/Queries/Properties/FileInfoPropertyProvider.cs +++ b/WikiClientLibrary/Pages/Queries/Properties/FileInfoPropertyProvider.cs @@ -27,12 +27,12 @@ public class FileInfoPropertyProvider : WikiPagePropertyProvider { { "iiprop", string.Join("|", properties) }, }; + return new OrderedKeyValuePairs { { "iiprop", string.Join("|", properties) } }; } /// diff --git a/WikiClientLibrary/Pages/Queries/Properties/GeoCoordinatesPropertyProvider.cs b/WikiClientLibrary/Pages/Queries/Properties/GeoCoordinatesPropertyProvider.cs index 041181906..77e1c9053 100644 --- a/WikiClientLibrary/Pages/Queries/Properties/GeoCoordinatesPropertyProvider.cs +++ b/WikiClientLibrary/Pages/Queries/Properties/GeoCoordinatesPropertyProvider.cs @@ -40,7 +40,7 @@ public class GeoCoordinatesPropertyProvider : WikiPagePropertyProvider public override IEnumerable> EnumParameters(MediaWikiVersion version) { - var p = new OrderedKeyValuePairs { { "coprop", "globe|dim" }, }; + var p = new OrderedKeyValuePairs { { "coprop", "globe|dim" } }; if (QueryPrimaryCoordinate && QuerySecondaryCoordinate) p.Add("coprimary", "all"); else if (QueryPrimaryCoordinate) diff --git a/WikiClientLibrary/Pages/Queries/Properties/PageImagesPropertyProvider.cs b/WikiClientLibrary/Pages/Queries/Properties/PageImagesPropertyProvider.cs index 79fd647f6..a4c05e711 100644 --- a/WikiClientLibrary/Pages/Queries/Properties/PageImagesPropertyProvider.cs +++ b/WikiClientLibrary/Pages/Queries/Properties/PageImagesPropertyProvider.cs @@ -116,7 +116,7 @@ private static PageImageInfo ParseImageInfo(JsonNode root) { Url = (string)root["source"], Width = (int)root["width"], - Height = (int)root["height"] + Height = (int)root["height"], }; } diff --git a/WikiClientLibrary/Pages/Queries/Properties/PagePropertiesPropertyProvider.cs b/WikiClientLibrary/Pages/Queries/Properties/PagePropertiesPropertyProvider.cs index c3544c305..319d0ed61 100644 --- a/WikiClientLibrary/Pages/Queries/Properties/PagePropertiesPropertyProvider.cs +++ b/WikiClientLibrary/Pages/Queries/Properties/PagePropertiesPropertyProvider.cs @@ -12,7 +12,7 @@ public class PagePropertiesPropertyProvider : WikiPagePropertyProvider { - { "ppprop", SelectedProperties == null ? null : MediaWikiHelper.JoinValues(SelectedProperties) } + { "ppprop", SelectedProperties == null ? null : MediaWikiHelper.JoinValues(SelectedProperties) }, }; } diff --git a/WikiClientLibrary/Pages/Queries/Properties/RevisionsPropertyProvider.cs b/WikiClientLibrary/Pages/Queries/Properties/RevisionsPropertyProvider.cs index 8eb414db5..271e72ef4 100644 --- a/WikiClientLibrary/Pages/Queries/Properties/RevisionsPropertyProvider.cs +++ b/WikiClientLibrary/Pages/Queries/Properties/RevisionsPropertyProvider.cs @@ -45,7 +45,7 @@ public class RevisionsPropertyProvider : WikiPagePropertyProvider> Properties public virtual IEnumerable> EnumParameters(MediaWikiVersion version) { var propBuilder = new StringBuilder(); - var p = new OrderedKeyValuePairs { { "action", "query" }, { "redirects", ResolveRedirects }, { "maxlag", 5 }, }; + var p = new OrderedKeyValuePairs { { "action", "query" }, { "redirects", ResolveRedirects }, { "maxlag", 5 } }; if (_Properties != null) { foreach (var prop in _Properties) diff --git a/WikiClientLibrary/Pages/WikiPageStub.cs b/WikiClientLibrary/Pages/WikiPageStub.cs index 13e95983b..2d6b7d123 100644 --- a/WikiClientLibrary/Pages/WikiPageStub.cs +++ b/WikiClientLibrary/Pages/WikiPageStub.cs @@ -231,7 +231,7 @@ public static async IAsyncEnumerable FromPageIds(WikiSite site, IE foreach (var partition in ids.Partition(titleLimit)) { var jresult = await site.InvokeMediaWikiApiAsync( - new MediaWikiFormRequestMessage(new { action = "query", pageids = MediaWikiHelper.JoinValues(partition), }), + new MediaWikiFormRequestMessage(new { action = "query", pageids = MediaWikiHelper.JoinValues(partition) }), cancellationToken); Debug.Assert(jresult["query"] != null); var jpages = jresult["query"]["pages"]; diff --git a/WikiClientLibrary/RequestHelper.cs b/WikiClientLibrary/RequestHelper.cs index 6dc431735..de2df0fda 100644 --- a/WikiClientLibrary/RequestHelper.cs +++ b/WikiClientLibrary/RequestHelper.cs @@ -516,7 +516,7 @@ public static IAsyncEnumerable EnumTransclusionsAsync(WikiSite site, str { "prop", "templates" }, { "tllimit", limit > 0 ? limit : site.ListingPagingSize }, { "tlnamespace", namespaces == null ? null : MediaWikiHelper.JoinValues(namespaces) }, - { "tltemplates", transcludedTitlesExpr == null ? null : MediaWikiHelper.JoinValues(transcludedTitlesExpr) } + { "tltemplates", transcludedTitlesExpr == null ? null : MediaWikiHelper.JoinValues(transcludedTitlesExpr) }, }; pa["titles"] = titlesExpr; var resultCounter = 0; diff --git a/WikiClientLibrary/Scribunto/ScribuntoConsole.cs b/WikiClientLibrary/Scribunto/ScribuntoConsole.cs index d512c9104..897b44fa2 100644 --- a/WikiClientLibrary/Scribunto/ScribuntoConsole.cs +++ b/WikiClientLibrary/Scribunto/ScribuntoConsole.cs @@ -184,7 +184,7 @@ internal static async Task InvokeApiAsync(WikiSite si title = title, clear = clear, question = question, - content = content + content = content, }), ct); } catch (InvalidActionException ex) @@ -198,7 +198,7 @@ internal static async Task InvokeApiAsync(WikiSite si ScribuntoEvaluationResultType.Normal => result, ScribuntoEvaluationResultType.Error => throw new ScribuntoConsoleException((string)jresult["messagename"], (string)jresult["message"], result), - _ => throw new UnexpectedDataException($"Unexpected evaluation result type: {(string)jresult["type"]}.") + _ => throw new UnexpectedDataException($"Unexpected evaluation result type: {(string)jresult["type"]}."), }; } diff --git a/WikiClientLibrary/Sites/SiteInfo.cs b/WikiClientLibrary/Sites/SiteInfo.cs index 5f84db33b..14c69b0b1 100644 --- a/WikiClientLibrary/Sites/SiteInfo.cs +++ b/WikiClientLibrary/Sites/SiteInfo.cs @@ -276,7 +276,7 @@ private string Case { "case-sensitive" => true, "first-letter" => false, - _ => throw new ArgumentException("Invalid case value.") + _ => throw new ArgumentException("Invalid case value."), }; } } diff --git a/WikiClientLibrary/Sites/SiteOptions.cs b/WikiClientLibrary/Sites/SiteOptions.cs index a67bfce42..0308ba6c6 100644 --- a/WikiClientLibrary/Sites/SiteOptions.cs +++ b/WikiClientLibrary/Sites/SiteOptions.cs @@ -96,7 +96,7 @@ public enum AccountAssertionBehavior /// /// Checks for "bot" user right, or "user" if the former is not applicable per request. /// - AssertAll = AssertUser | AssertBot + AssertAll = AssertUser | AssertBot, } diff --git a/WikiClientLibrary/Sites/WikiSite.Query.cs b/WikiClientLibrary/Sites/WikiSite.Query.cs index c8d0beaa4..9c0af90e0 100644 --- a/WikiClientLibrary/Sites/WikiSite.Query.cs +++ b/WikiClientLibrary/Sites/WikiSite.Query.cs @@ -12,7 +12,7 @@ partial class WikiSite private async Task FetchMessagesAsync(string messagesExpr, CancellationToken cancellationToken) { var jresult = await InvokeMediaWikiApiAsync( - new MediaWikiFormRequestMessage(new { action = "query", meta = "allmessages", ammessages = messagesExpr, }), cancellationToken); + new MediaWikiFormRequestMessage(new { action = "query", meta = "allmessages", ammessages = messagesExpr }), cancellationToken); return jresult["query"]["allmessages"]!.AsArray(); //return jresult.ToDictionary(m => , m => (string) m["*"]); } @@ -136,7 +136,7 @@ public Task GetStatisticsAsync() public async Task GetStatisticsAsync(CancellationToken cancellationToken) { var jobj = await InvokeMediaWikiApiAsync( - new MediaWikiFormRequestMessage(new { action = "query", meta = "siteinfo", siprop = "statistics", }), cancellationToken); + new MediaWikiFormRequestMessage(new { action = "query", meta = "siteinfo", siprop = "statistics" }), cancellationToken); var jstat = jobj["query"]?["statistics"]?.AsObject(); if (jstat == null) throw new UnexpectedDataException(); var parsed = jstat.Deserialize(MediaWikiHelper.WikiJsonSerializerOptions); diff --git a/WikiClientLibrary/Sites/WikiSite.cs b/WikiClientLibrary/Sites/WikiSite.cs index c8d736dcb..55beb1092 100644 --- a/WikiClientLibrary/Sites/WikiSite.cs +++ b/WikiClientLibrary/Sites/WikiSite.cs @@ -183,7 +183,7 @@ public virtual async Task RefreshSiteInfoAsync() { action = "query", meta = "siteinfo", - siprop = "general|namespaces|namespacealiases|interwikimap|extensions|magicwords" + siprop = "general|namespaces|namespacealiases|interwikimap|extensions|magicwords", }), true, CancellationToken.None); var qg = jobj["query"]["general"].AsObject(); var ns = jobj["query"]["namespaces"].AsObject(); diff --git a/WikiClientLibrary/UserStub.cs b/WikiClientLibrary/UserStub.cs index e156014e4..6dacb2a20 100644 --- a/WikiClientLibrary/UserStub.cs +++ b/WikiClientLibrary/UserStub.cs @@ -95,6 +95,6 @@ public enum Gender Male, /// Female. - Female + Female, } diff --git a/WikiClientLibrary/Utility.cs b/WikiClientLibrary/Utility.cs index f88fb1749..1d1a40b5d 100644 --- a/WikiClientLibrary/Utility.cs +++ b/WikiClientLibrary/Utility.cs @@ -56,7 +56,7 @@ public static void MergeFrom(this IDictionary dict, AutoWatchBehavior.None => "nochange", AutoWatchBehavior.Watch => "watch", AutoWatchBehavior.Unwatch => "unwatch", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) + _ => throw new ArgumentOutOfRangeException(nameof(value), value, null), }, DateTime dt => dt.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssK", CultureInfo.InvariantCulture), // ISO 8601 IFormattable fmt => fmt.ToString(null, CultureInfo.InvariantCulture), @@ -92,7 +92,7 @@ public static IEnumerable> Partition(this IEnumerable< PropertyFilterOption.Disable => allValue, PropertyFilterOption.WithProperty => withValue, PropertyFilterOption.WithoutProperty => withoutValue, - _ => throw new ArgumentOutOfRangeException(nameof(value), value, null) + _ => throw new ArgumentOutOfRangeException(nameof(value), value, null), }; } diff --git a/WikiClientLibrary/WikiClientLibrary.csproj b/WikiClientLibrary/WikiClientLibrary.csproj index 603a2f26b..af2ee6c0d 100644 --- a/WikiClientLibrary/WikiClientLibrary.csproj +++ b/WikiClientLibrary/WikiClientLibrary.csproj @@ -27,7 +27,7 @@ - + diff --git a/WikiClientLibrary/WikiLink.cs b/WikiClientLibrary/WikiLink.cs index 4ddf2d740..3b33a6147 100644 --- a/WikiClientLibrary/WikiLink.cs +++ b/WikiClientLibrary/WikiLink.cs @@ -225,7 +225,7 @@ public static WikiLink Parse(WikiSite site, string text, int defaultNamespaceId) NamespaceName = nsPrefix, Title = localTitle, FullTitle = localTitle, - TargetSite = targetSite + TargetSite = targetSite, }; link.Namespace = nsPrefix != null && link.TargetSite != null ? link.TargetSite.Namespaces[nsPrefix]