From 52e48da385957cf084f47f4c9c09932704c34a69 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Thu, 6 Jul 2023 08:12:30 +0900 Subject: [PATCH 1/2] Add Visual Studio spell checker configs --- .editorconfig | 7 + SpellingExclusions.dic | 350 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 357 insertions(+) create mode 100644 SpellingExclusions.dic diff --git a/.editorconfig b/.editorconfig index c86dc2657af..654133d6d52 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,13 @@ indent_style = space indent_size = 4 trim_trailing_whitespace = true +# Visual Studio Spell checker configs (https://learn.microsoft.com/en-us/visualstudio/ide/text-spell-checker?view=vs-2022) +[*] +spelling_languages = en-us +spelling_checkable_types = strings,identifiers,comments +spelling_error_severity = warning +spelling_exclusion_path = ./SpellingExclusions.dic + # Generated code [*{_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs}] generated_code = true diff --git a/SpellingExclusions.dic b/SpellingExclusions.dic new file mode 100644 index 00000000000..e32df13cdfd --- /dev/null +++ b/SpellingExclusions.dic @@ -0,0 +1,350 @@ +abbr +abc +abc' +abcdef +accum +actionscript +activerecord +aded +aggregatebykey +allowfullscreen +Alsos +apidoc +appsettings +arbo +arduino +ascx +asdjklf +aspx +assetid +attendeeid +attrs +autolink +azurecli +azureml +badattribute +batchfile +bcd' +bcdc +bcrypt' +bdir +bfile +blib +bodyparam +bootsnap' +Bproj +Builtin +builtins +byebug' +carolz +ccbb +cdir +cellx +cfile +changefreq +choco +Chromeless +Cillegal +classlib +cntk +codesnippet +colspan +Conceptuals +connectionsucceeded +contextobject +commonmark +Cooooooool +corob +cref +crefs +Crlf +csdl +csharp +cshtml +csproj +csrf +csyaml +csyml +Ctypescript +cuda +datalist +dedent +Dedent +defaultfilterconfig +definitionlists +dependants +describedby +Deserializer +Deserializers +dest +Devlangs +devsandbox +dict' +displaytext +divb +dlang +docascode +docfx +Docset +docset +domaininfo +Donotinsertspaceininlinehtmltags +Dryrun +edmx +eedcbf +embeddedvideo +english +Expando +Facade +facade +fazure +fbfc +fenxu +filepath +Fillegal +filterconfig +fnptr +fsharp +ftoc +fullname +fvirtual +fwindows +gcnew +getted +ghogen +github +githubusercontent +gitignore +Gitter +globals +globstar +golang +gradle +haskell +herohua +HHmmssffff +Hmlr +Hmmssffff +Hsts +Htmls +httparty +httparty' +hypertrm +iaggregate +icat +icoll +iframe +iframes +Impl +Imple +Informations +Infos +inlines +innerothers +innersinner +innerunique +intellisensed +invalidtmpl +Ipsom +ipynb +istreamable +javascript +jbuilder' +Jint +jruby +json +json' +langs +languagekeyword +Langwords +lastmod +lgtm +linenumber +linktype +looooooooooooooooooooooooooooooooooooog +loopref +Manip +marco +Markdig +matlab +Memberwise +microsoft +mingw +moduleunit +Mref +msbuild +msdn +mseng +msft +mslearn +mswin +multinamespace +mycontainer +myorganization +myproduct +namedarguments +namespaced +nasm +navpanel +navpanel' +netstandard +nocheck +nocookie +noindex +noindex' +Noloc +noscript +notexist +Notset +nullptr +oarray +oauth +objc +objectivec +odata +odict +omniauth +opath +openlocfilehash +ovms +perl +Petstore +pltfrm +popularised +Postbuild +postbuild +Postbuilding +powershell +preproceesor +Properties +pubid +Quickstarts +rawmodel +redis' +refa +refb +refc +Refmap +restapi +restruction +Restructions +ronpet +rowgroup +rowgroups +rowspan +rpetrusha +samp +sarray +scala +Schlinkert +sdict +sdp +sdps +sdp's +shrinked +smalltalk +snippetname +snippetprogram +soucefile +sourcefile +sourcegitcommit +sourcestartlinenumber +speakerevals +speakerevalscurrent +splitted +sqlite +Stackalloc +startswith +Stdcall +Stdout +stdout +Streamable +streamprocessing +stringified +stringify +stylecop +Subber +submittext +sysid +tabgroup +tabindex +tablist +tabpanel +Tagname +tagname +tasklists +tbody +tcontext +Technet +testmerger +testsnippet +testtoken +textarea +tfoot +thead +Thiscall +tkey +tmpl +tocmd +Tocs +tocyaml +tokenblock +toplevel +toppest +tostring +translationtype +Transpile +Turbolinks +Turbolinks' +tvalue +tzinfo +udbff' +Uids +undeterministic +Unescape +ungrouper +Uref +uris +urls +Urls +urlset +Vararg +vbhtml +vbnet +vbproj +vbscript +Veyor +videoplayer +viewmodel +visualstudio +Vsinstalldir +webdriver' +webdrivers' +webpacker' +wildchar +winword +withgaps +wkhtmltopdf +wordpad +wpickett +wsdl +xaml' +xmsexamples +Xref +xref +XRefmap +xrefmap +xrefmaps +Xrefs +xrefspec +Yaml +yamlheader +youtube +yyyy +zoneinfo +ãâáà +êé +í +õôó +Типы +шрифтов From 337e9b440fe4dee863c816a7d5b7c5184350b318 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Thu, 6 Jul 2023 08:24:45 +0900 Subject: [PATCH 2/2] Fix spellings --- README.md | 2 +- .../SplitRestApiToOperationLevel.cs | 6 +- .../SplitRestApiToTagLevel.cs | 8 +- .../MarkdownReader.cs | 10 +- .../ReflectionHelper.cs | 6 +- .../CountWord.cs | 4 +- .../Preprocessors/JintProcessorHelper.cs | 4 +- .../PreprocessorWithResourcePool.cs | 4 +- .../ViewRenderers/RendererWithResourcePool.cs | 4 +- .../XrefClient.cs | 8 +- .../ApplyPlatformVersion.cs | 6 +- .../SplitClassPageToMemberLevel.cs | 8 +- ...Creater.cs => MarkdownFragmentsCreator.cs} | 2 +- ...er.cs => OverwriteDocumentModelCreator.cs} | 4 +- .../ApplyOverwriteDocument.cs | 6 +- .../ApplyOverwriteFragments.cs | 8 +- .../CommandUtility.cs | 2 +- .../ConvertToObjectHelper.cs | 4 +- .../Git/GitUtility.cs | 2 +- .../Path/PathUtility.cs | 2 +- .../StringExtension.cs | 4 +- .../JTokenConverter.cs | 4 +- .../MetadataJsonConfig.cs | 2 +- .../Parsers/XmlComment.cs | 6 +- .../SymbolUrlResolver.MSLearn.cs | 2 +- .../Visitors/SymbolVisitorAdapter.cs | 28 ++--- src/Microsoft.DocAsCode.Glob/FileGlob.cs | 4 +- src/Microsoft.DocAsCode.Glob/GlobMatcher.cs | 6 +- .../Transformer/HtmlNotInTocTransformer.cs | 4 +- .../RemoveQueryStringTransformer.cs | 6 +- .../CodeSnippet/CodeSnippetExtractor.cs | 10 +- .../CodeSnippet/HtmlCodeSnippetRenderer.cs | 8 +- .../TripleColon/ZoneExtension.cs | 2 +- .../Validation/MarkdownValidatorBuilder.cs | 12 +-- .../YamlHeader/YamlHeaderRenderer.cs | 2 +- .../ManifestItemCollectionConverter.cs | 2 +- ...nSytleConfig.cs => MarkdownStyleConfig.cs} | 2 +- .../MarkdownSytleDefinition.cs | 2 +- .../Helpers/ReflectionUtility.cs | 6 +- .../TypeInspectors/EmitTypeInspector.cs | 20 ++-- src/docfx/Models/BuildCommandOptions.cs | 2 +- src/docfx/Models/InitCommand.cs | 10 +- src/docfx/Models/MetadataCommandOptions.cs | 2 +- .../DocumentBuilderTest.cs | 10 +- .../TemplateManagerUnitTest.cs | 6 +- .../XRefArchiveBuilderTest.cs | 2 +- .../XRefMapDownloaderTest.cs | 2 +- ...est.cs => MarkdownFragmentsCreatorTest.cs} | 10 +- ...s => OverwriteDocumentModelCreatorTest.cs} | 22 ++-- .../OverwriteUtilityTest.cs | 4 +- .../RestApiDocumentProcessorTest.cs | 6 +- .../SwaggerJsonParserTest.cs | 32 +++--- ...gable.md => rest.overwrite.unmergeable.md} | 0 .../SplitRestApiToOperationLevelTest.cs | 6 +- .../LimitationReachedTest.cs | 2 +- .../MarkdownFragmentsValidationTest.cs | 2 +- .../RelativePathTest.cs | 4 +- .../UriTemplateTest.cs | 2 +- .../YamlDeserializerWithFallbackTest.cs | 18 ++-- .../YamlSerializationTest.cs | 2 +- .../GenerateMetadataFromCSUnitTest.cs | 102 +++++++++--------- .../GenerateMetadataFromVBUnitTest.cs | 28 ++--- .../InclusionTest.cs | 10 +- test/docfx.Tests/CompositeCommandTest.cs | 4 +- 64 files changed, 260 insertions(+), 260 deletions(-) rename src/Microsoft.DocAsCode.Build.OverwriteDocuments/{MarkdownFragmentsCreater.cs => MarkdownFragmentsCreator.cs} (98%) rename src/Microsoft.DocAsCode.Build.OverwriteDocuments/{OverwriteDocumentModelCreater.cs => OverwriteDocumentModelCreator.cs} (98%) rename src/Microsoft.DocAsCode.Plugins/{MarkdownSytleConfig.cs => MarkdownStyleConfig.cs} (95%) rename test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/{MarkdownFragmentsCreaterTest.cs => MarkdownFragmentsCreatorTest.cs} (89%) rename test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/{OverwriteDocumentModelCreaterTest.cs => OverwriteDocumentModelCreatorTest.cs} (94%) rename test/Microsoft.DocAsCode.Build.RestApi.Tests/TestData/overwrite/{rest.overwrite.unmergable.md => rest.overwrite.unmergeable.md} (100%) diff --git a/README.md b/README.md index 1e0a1c3ef21..8c4bebfaf69 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ We welcome code contributions through pull requests, issues tagged as **[`help-w ### Branch and Release -The `main` branch is the default branch for pull requests and most other development activities. We occationally use `feature/*` branches for epic feature development. +The `main` branch is the default branch for pull requests and most other development activities. We occasionally use `feature/*` branches for epic feature development. Releases are based on a stable `main` branch commit using [GitHub Releases](https://github.com/dotnet/docfx/releases). Use of [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) is encouraged. diff --git a/plugins/Microsoft.DocAsCode.Build.OperationLevelRestApi/SplitRestApiToOperationLevel.cs b/plugins/Microsoft.DocAsCode.Build.OperationLevelRestApi/SplitRestApiToOperationLevel.cs index 257b31f45f8..5925b63273a 100644 --- a/plugins/Microsoft.DocAsCode.Build.OperationLevelRestApi/SplitRestApiToOperationLevel.cs +++ b/plugins/Microsoft.DocAsCode.Build.OperationLevelRestApi/SplitRestApiToOperationLevel.cs @@ -32,15 +32,15 @@ public override IEnumerable<FileModel> Prebuild(ImmutableList<FileModel> models, { collection.AddRange(result.Item1); - var tocRestuctions = result.Item2; - var duplicateKeys = tocRestuctions.Where(t => treeItemRestructions.Any(i => i.Key == t.Key)).Select(i => i.Key); + var tocRestructions = result.Item2; + var duplicateKeys = tocRestructions.Where(t => treeItemRestructions.Any(i => i.Key == t.Key)).Select(i => i.Key); if (duplicateKeys.Any()) { Logger.LogWarning($"Model with the key {string.Join(",", duplicateKeys)} already exists. '{model.OriginalFileAndType?.FullPath ?? model.FileAndType.FullPath}' is ignored."); } else { - treeItemRestructions.AddRange(tocRestuctions); + treeItemRestructions.AddRange(tocRestructions); } } } diff --git a/plugins/Microsoft.DocAsCode.Build.TagLevelRestApi/SplitRestApiToTagLevel.cs b/plugins/Microsoft.DocAsCode.Build.TagLevelRestApi/SplitRestApiToTagLevel.cs index 88eb6b7a161..17ccdd95dec 100644 --- a/plugins/Microsoft.DocAsCode.Build.TagLevelRestApi/SplitRestApiToTagLevel.cs +++ b/plugins/Microsoft.DocAsCode.Build.TagLevelRestApi/SplitRestApiToTagLevel.cs @@ -31,14 +31,14 @@ public override IEnumerable<FileModel> Prebuild(ImmutableList<FileModel> models, { collection.AddRange(result.Item1); - var tocRestuction = result.Item2; - if (treeItemRestructions.Any(i => i.Key == tocRestuction.Key)) + var tocRestruction = result.Item2; + if (treeItemRestructions.Any(i => i.Key == tocRestruction.Key)) { - Logger.LogWarning($"Model with the key {tocRestuction.Key} already exists. '{model.OriginalFileAndType?.FullPath ?? model.FileAndType.FullPath}' is ignored."); + Logger.LogWarning($"Model with the key {tocRestruction.Key} already exists. '{model.OriginalFileAndType?.FullPath ?? model.FileAndType.FullPath}' is ignored."); } else { - treeItemRestructions.Add(tocRestuction); + treeItemRestructions.Add(tocRestruction); } } } diff --git a/src/Microsoft.DocAsCode.Build.Common/MarkdownReader.cs b/src/Microsoft.DocAsCode.Build.Common/MarkdownReader.cs index f19c3ab2751..cf3bd4ed64e 100644 --- a/src/Microsoft.DocAsCode.Build.Common/MarkdownReader.cs +++ b/src/Microsoft.DocAsCode.Build.Common/MarkdownReader.cs @@ -52,7 +52,7 @@ private static OverwriteDocumentModel TransformModel(string filePath, YamlHtmlPa throw new InvalidDataException(checkPropertyMessage); } - var overriden = RemoveRequiredProperties(properties, RequiredProperties); + var overridden = RemoveRequiredProperties(properties, RequiredProperties); var repoInfo = GitUtility.TryGetFileDetail(filePath); return new OverwriteDocumentModel @@ -62,7 +62,7 @@ private static OverwriteDocumentModel TransformModel(string filePath, YamlHtmlPa LinkToUids = new HashSet<string>(part.LinkToUids), FileLinkSources = part.FileLinkSources.ToDictionary(p => p.Key, p => p.Value.ToList()), UidLinkSources = part.UidLinkSources.ToDictionary(p => p.Key, p => p.Value.ToList()), - Metadata = overriden, + Metadata = overridden, Conceptual = part.Conceptual, Documentation = new SourceDetail { @@ -109,16 +109,16 @@ private static Dictionary<string, object> RemoveRequiredProperties(ImmutableDict return null; } - var overridenProperties = new Dictionary<string, object>(properties.OrderBy(p => p.Key)); + var overriddenProperties = new Dictionary<string, object>(properties.OrderBy(p => p.Key)); foreach (var requiredProperty in requiredProperties) { if (requiredProperty != null) { - overridenProperties.Remove(requiredProperty); + overriddenProperties.Remove(requiredProperty); } } - return overridenProperties; + return overriddenProperties; } private static bool CheckRequiredProperties(ImmutableDictionary<string, object> properties, IEnumerable<string> requiredKeys, out string message) diff --git a/src/Microsoft.DocAsCode.Build.Common/ModelAttributeHandlers/ReflectionHelper.cs b/src/Microsoft.DocAsCode.Build.Common/ModelAttributeHandlers/ReflectionHelper.cs index 8d19d6a6ab4..9e63078b052 100644 --- a/src/Microsoft.DocAsCode.Build.Common/ModelAttributeHandlers/ReflectionHelper.cs +++ b/src/Microsoft.DocAsCode.Build.Common/ModelAttributeHandlers/ReflectionHelper.cs @@ -185,8 +185,8 @@ private static bool IsDictionaryTypeCore(Type type) return true; } - return ImplementsGenericDefintion(type, typeof(IDictionary<,>)) || - ImplementsGenericDefintion(type, typeof(IReadOnlyDictionary<,>)); + return ImplementsGenericDefinition(type, typeof(IDictionary<,>)) || + ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary<,>)); } public static bool IsIEnumerableType(Type t) @@ -225,7 +225,7 @@ public static bool TryGetGenericType(Type type, Type genericTypeDefinition, out return genericType != null; } - public static bool ImplementsGenericDefintion(Type type, Type genericTypeDefinition) + public static bool ImplementsGenericDefinition(Type type, Type genericTypeDefinition) { return GetGenericType(type, genericTypeDefinition) != null; } diff --git a/src/Microsoft.DocAsCode.Build.ConceptualDocuments/CountWord.cs b/src/Microsoft.DocAsCode.Build.ConceptualDocuments/CountWord.cs index bf0cda2db52..92c83d1af47 100644 --- a/src/Microsoft.DocAsCode.Build.ConceptualDocuments/CountWord.cs +++ b/src/Microsoft.DocAsCode.Build.ConceptualDocuments/CountWord.cs @@ -81,9 +81,9 @@ private static int CountWordInText(string text) } string specialChars = ".?!;:,()[]"; - char[] delimChars = { ' ', '\t', '\n' }; + char[] delimiterChars = { ' ', '\t', '\n' }; - string[] wordList = text.Split(delimChars, StringSplitOptions.RemoveEmptyEntries); + string[] wordList = text.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); return wordList.Count(s => !s.Trim().All(specialChars.Contains)); } } diff --git a/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/JintProcessorHelper.cs b/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/JintProcessorHelper.cs index 282ab255934..4ccefc9e192 100644 --- a/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/JintProcessorHelper.cs +++ b/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/JintProcessorHelper.cs @@ -9,10 +9,10 @@ public static class JintProcessorHelper { public static JsValue ConvertObjectToJsValue(Jint.Engine engine, object raw) { - if (raw is IDictionary<string, object> idict) + if (raw is IDictionary<string, object> dict) { var jsObject = new JsObject(engine); - foreach (var pair in idict) + foreach (var pair in dict) { jsObject.FastSetDataProperty(pair.Key, ConvertObjectToJsValue(engine, pair.Value)); } diff --git a/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/PreprocessorWithResourcePool.cs b/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/PreprocessorWithResourcePool.cs index 39271911459..ee01c6a78a0 100644 --- a/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/PreprocessorWithResourcePool.cs +++ b/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/Preprocessors/PreprocessorWithResourcePool.cs @@ -10,9 +10,9 @@ internal class PreprocessorWithResourcePool : ITemplatePreprocessor { private readonly ResourcePoolManager<ITemplatePreprocessor> _preprocessorPool; - public PreprocessorWithResourcePool(Func<ITemplatePreprocessor> creater, int maxParallelism) + public PreprocessorWithResourcePool(Func<ITemplatePreprocessor> creator, int maxParallelism) { - _preprocessorPool = ResourcePool.Create(creater, maxParallelism); + _preprocessorPool = ResourcePool.Create(creator, maxParallelism); try { using var preprocessor = _preprocessorPool.Rent(); diff --git a/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/ViewRenderers/RendererWithResourcePool.cs b/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/ViewRenderers/RendererWithResourcePool.cs index ec056f7daea..a8eb0c647c1 100644 --- a/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/ViewRenderers/RendererWithResourcePool.cs +++ b/src/Microsoft.DocAsCode.Build.Engine/TemplateProcessors/ViewRenderers/RendererWithResourcePool.cs @@ -8,9 +8,9 @@ namespace Microsoft.DocAsCode.Build.Engine; internal class RendererWithResourcePool : ITemplateRenderer { private readonly ResourcePoolManager<ITemplateRenderer> _rendererPool; - public RendererWithResourcePool(Func<ITemplateRenderer> creater, int maxParallelism) + public RendererWithResourcePool(Func<ITemplateRenderer> creator, int maxParallelism) { - _rendererPool = ResourcePool.Create(creater, maxParallelism); + _rendererPool = ResourcePool.Create(creator, maxParallelism); using var lease = _rendererPool.Rent(); var inner = lease.Resource; diff --git a/src/Microsoft.DocAsCode.Build.Engine/XrefClient.cs b/src/Microsoft.DocAsCode.Build.Engine/XrefClient.cs index e9c9e61ec08..56f25a2db3c 100644 --- a/src/Microsoft.DocAsCode.Build.Engine/XrefClient.cs +++ b/src/Microsoft.DocAsCode.Build.Engine/XrefClient.cs @@ -28,14 +28,14 @@ public XrefClient() public XrefClient(HttpClient client) : this(null, null) { } - public XrefClient(int maxParallism) - : this(null, new SemaphoreSlim(maxParallism)) { } + public XrefClient(int maxParallelism) + : this(null, new SemaphoreSlim(maxParallelism)) { } public XrefClient(SemaphoreSlim semaphore) : this(null, semaphore) { } - public XrefClient(HttpClient client, int maxParallism) - : this(client, new SemaphoreSlim(maxParallism)) { } + public XrefClient(HttpClient client, int maxParallelism) + : this(client, new SemaphoreSlim(maxParallelism)) { } public XrefClient(HttpClient client, SemaphoreSlim semaphore) { diff --git a/src/Microsoft.DocAsCode.Build.ManagedReference/ApplyPlatformVersion.cs b/src/Microsoft.DocAsCode.Build.ManagedReference/ApplyPlatformVersion.cs index ce59abe44e8..9ee379639c0 100644 --- a/src/Microsoft.DocAsCode.Build.ManagedReference/ApplyPlatformVersion.cs +++ b/src/Microsoft.DocAsCode.Build.ManagedReference/ApplyPlatformVersion.cs @@ -69,15 +69,15 @@ private static List<string> GetPlatformVersionFromMetadata(object value) return collection.OfType<string>().ToList(); } - if (value is JArray jarray) + if (value is JArray jArray) { try { - return jarray.ToObject<List<string>>(); + return jArray.ToObject<List<string>>(); } catch (Exception) { - Logger.LogWarning($"Unknown platform-version metadata: {jarray.ToString()}"); + Logger.LogWarning($"Unknown platform-version metadata: {jArray.ToString()}"); } } diff --git a/src/Microsoft.DocAsCode.Build.ManagedReference/SplitClassPageToMemberLevel.cs b/src/Microsoft.DocAsCode.Build.ManagedReference/SplitClassPageToMemberLevel.cs index 86f66b7c93c..e3b83fb63d4 100644 --- a/src/Microsoft.DocAsCode.Build.ManagedReference/SplitClassPageToMemberLevel.cs +++ b/src/Microsoft.DocAsCode.Build.ManagedReference/SplitClassPageToMemberLevel.cs @@ -120,7 +120,7 @@ private string GetUniqueFilePath(string dupePath, string newFileName, Dictionary } else { - // new file path already exist but doesnt have suffix (special case) + // new file path already exist but doesn't have suffix (special case) newFileName = newFileName + "_1"; newFilePaths[newFilePath] = 2; } @@ -603,15 +603,15 @@ private List<string> GetListFromObject(object value) return collection.OfType<string>().ToList(); } - if (value is JArray jarray) + if (value is JArray jArray) { try { - return jarray.ToObject<List<string>>(); + return jArray.ToObject<List<string>>(); } catch (Exception) { - Logger.LogWarning($"Unknown version metadata: {jarray.ToString()}"); + Logger.LogWarning($"Unknown version metadata: {jArray.ToString()}"); } } diff --git a/src/Microsoft.DocAsCode.Build.OverwriteDocuments/MarkdownFragmentsCreater.cs b/src/Microsoft.DocAsCode.Build.OverwriteDocuments/MarkdownFragmentsCreator.cs similarity index 98% rename from src/Microsoft.DocAsCode.Build.OverwriteDocuments/MarkdownFragmentsCreater.cs rename to src/Microsoft.DocAsCode.Build.OverwriteDocuments/MarkdownFragmentsCreator.cs index 59f3900c43c..2d476996f5d 100644 --- a/src/Microsoft.DocAsCode.Build.OverwriteDocuments/MarkdownFragmentsCreater.cs +++ b/src/Microsoft.DocAsCode.Build.OverwriteDocuments/MarkdownFragmentsCreator.cs @@ -5,7 +5,7 @@ namespace Microsoft.DocAsCode.Build.OverwriteDocuments; -public class MarkdownFragmentsCreater +public class MarkdownFragmentsCreator { /* diff --git a/src/Microsoft.DocAsCode.Build.OverwriteDocuments/OverwriteDocumentModelCreater.cs b/src/Microsoft.DocAsCode.Build.OverwriteDocuments/OverwriteDocumentModelCreator.cs similarity index 98% rename from src/Microsoft.DocAsCode.Build.OverwriteDocuments/OverwriteDocumentModelCreater.cs rename to src/Microsoft.DocAsCode.Build.OverwriteDocuments/OverwriteDocumentModelCreator.cs index b0b877510a6..29b5fc4529e 100644 --- a/src/Microsoft.DocAsCode.Build.OverwriteDocuments/OverwriteDocumentModelCreater.cs +++ b/src/Microsoft.DocAsCode.Build.OverwriteDocuments/OverwriteDocumentModelCreator.cs @@ -8,11 +8,11 @@ namespace Microsoft.DocAsCode.Build.OverwriteDocuments; -public class OverwriteDocumentModelCreater +public class OverwriteDocumentModelCreator { string _file; - public OverwriteDocumentModelCreater(string file) + public OverwriteDocumentModelCreator(string file) { _file = file ?? throw new ArgumentNullException(nameof(file)); } diff --git a/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteDocument.cs b/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteDocument.cs index 68a0913bf8d..d0777ce14ed 100644 --- a/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteDocument.cs +++ b/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteDocument.cs @@ -45,15 +45,15 @@ private void ApplyOverwriteToModel(OverwriteApplier overwriteApplier, string uid var schema = model.Properties.Schema as DocumentSchema; using (new LoggerFileScope(model.LocalPathFromRoot)) { - var uidDefiniton = model.Uids.Where(s => s.Name == uid).ToList(); - if (uidDefiniton.Count == 0) + var uidDefinition = model.Uids.Where(s => s.Name == uid).ToList(); + if (uidDefinition.Count == 0) { throw new DocfxException($"Unable to find UidDefinition for Uid {uid}"); } try { - foreach (var ud in uidDefiniton) + foreach (var ud in uidDefinition) { var jsonPointer = new JsonPointer(ud.Path).GetParentPointer(); var schemaForCurrentUid = jsonPointer.FindSchema(schema); diff --git a/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteFragments.cs b/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteFragments.cs index 1cfd7f5a8d9..e2c095c14a6 100644 --- a/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteFragments.cs +++ b/src/Microsoft.DocAsCode.Build.SchemaDriven/ApplyOverwriteFragments.cs @@ -77,7 +77,7 @@ public override void Build(FileModel model, IHostService host) private void BuildCore(FileModel model, IHostService host) { var markdownService = (MarkdigMarkdownService)model.MarkdownFragmentsModel.Properties.MarkdigMarkdownService; - var overwriteDocumentModelCreater = new OverwriteDocumentModelCreater(model.MarkdownFragmentsModel.OriginalFileAndType.File); + var overwriteDocumentModelCreator = new OverwriteDocumentModelCreator(model.MarkdownFragmentsModel.OriginalFileAndType.File); var overwriteApplier = new OverwriteApplier(host, OverwriteModelType.MarkdownFragments); var schema = model.Properties.Schema as DocumentSchema; List<OverwriteDocumentModel> overwriteDocumentModels; @@ -86,13 +86,13 @@ private void BuildCore(FileModel model, IHostService host) var ast = markdownService.Parse((string)model.MarkdownFragmentsModel.Content, model.MarkdownFragmentsModel.OriginalFileAndType.File); // 2 AST(MarkdownDocument) => MarkdownFragmentModel - var fragments = new MarkdownFragmentsCreater().Create(ast).ToList(); + var fragments = new MarkdownFragmentsCreator().Create(ast).ToList(); // 3. MarkdownFragmentModel => OverwriteDocument - overwriteDocumentModels = fragments.Select(overwriteDocumentModelCreater.Create).ToList(); + overwriteDocumentModels = fragments.Select(overwriteDocumentModelCreator.Create).ToList(); model.MarkdownFragmentsModel.Content = overwriteDocumentModels; - // Validate here as OverwriteDocumentModelCreater already filtered some invalid cases, e.g. duplicated H2 + // Validate here as OverwriteDocumentModelCreator already filtered some invalid cases, e.g. duplicated H2 ValidateWithSchema(fragments, model); // 4. Apply schema to OverwriteDocument, and merge with skeleton YAML object diff --git a/src/Microsoft.DocAsCode.Common/CommandUtility.cs b/src/Microsoft.DocAsCode.Common/CommandUtility.cs index e6009fdd8a7..844045a2981 100644 --- a/src/Microsoft.DocAsCode.Common/CommandUtility.cs +++ b/src/Microsoft.DocAsCode.Common/CommandUtility.cs @@ -137,7 +137,7 @@ public static bool ExistCommand(string commandName, Action<string> processOutput } // writer streams have to be flushed before reading from memory streams - // make sure that streamwriter is not closed before reading from memory stream + // make sure that StreamWriter is not closed before reading from memory stream outputStreamWriter.Flush(); errorStreamWriter.Flush(); diff --git a/src/Microsoft.DocAsCode.Common/ConvertToObjectHelper.cs b/src/Microsoft.DocAsCode.Common/ConvertToObjectHelper.cs index 53f6d762a39..fa363d42074 100644 --- a/src/Microsoft.DocAsCode.Common/ConvertToObjectHelper.cs +++ b/src/Microsoft.DocAsCode.Common/ConvertToObjectHelper.cs @@ -118,11 +118,11 @@ private static object ConvertToDynamicCore(object obj, Dictionary<object, object ((IDictionary<string, Object>)result).Add(key, ConvertToDynamicCore(pair.Value, cache)); } } - else if (obj is IDictionary<string, object> sdict) + else if (obj is IDictionary<string, object> sDict) { result = cache[obj] = new ExpandoObject(); - foreach (var pair in sdict) + foreach (var pair in sDict) { ((IDictionary<string, Object>)result).Add(pair.Key, ConvertToDynamicCore(pair.Value, cache)); } diff --git a/src/Microsoft.DocAsCode.Common/Git/GitUtility.cs b/src/Microsoft.DocAsCode.Common/Git/GitUtility.cs index 4c8f8865d84..b074d9ec319 100644 --- a/src/Microsoft.DocAsCode.Common/Git/GitUtility.cs +++ b/src/Microsoft.DocAsCode.Common/Git/GitUtility.cs @@ -340,7 +340,7 @@ private static void RunGitCommand(string repoPath, string arguments, Action<stri }, outputStreamWriter, errorStreamWriter, GitTimeOut); // writer streams have to be flushed before reading from memory streams - // make sure that streamwriter is not closed before reading from memory stream + // make sure that StreamWriter is not closed before reading from memory stream outputStreamWriter.Flush(); errorStreamWriter.Flush(); diff --git a/src/Microsoft.DocAsCode.Common/Path/PathUtility.cs b/src/Microsoft.DocAsCode.Common/Path/PathUtility.cs index 1261f6232e1..cd211f70964 100644 --- a/src/Microsoft.DocAsCode.Common/Path/PathUtility.cs +++ b/src/Microsoft.DocAsCode.Common/Path/PathUtility.cs @@ -35,7 +35,7 @@ public static bool IsPathCaseInsensitive() /// </summary> /// <param name="path"></param> /// <returns></returns> - public static bool IsVaildFilePath(string path) + public static bool IsValidFilePath(string path) { FileInfo fi = null; try diff --git a/src/Microsoft.DocAsCode.Common/StringExtension.cs b/src/Microsoft.DocAsCode.Common/StringExtension.cs index 39c07deccb7..50a414098ca 100644 --- a/src/Microsoft.DocAsCode.Common/StringExtension.cs +++ b/src/Microsoft.DocAsCode.Common/StringExtension.cs @@ -32,8 +32,8 @@ public static string GetNormalizedFullPathKey(this IEnumerable<string> list) if (list == null) return null; // make sure the order consistent - var nomalizedPaths = GetNormalizedFullPathList(list); - return nomalizedPaths.ToDelimitedString(); + var normalizedPaths = GetNormalizedFullPathList(list); + return normalizedPaths.ToDelimitedString(); } public static IEnumerable<string> GetNormalizedFullPathList(this IEnumerable<string> paths) diff --git a/src/Microsoft.DocAsCode.DataContracts.Common/JTokenConverter.cs b/src/Microsoft.DocAsCode.DataContracts.Common/JTokenConverter.cs index 8d57e143045..3d9b208479e 100644 --- a/src/Microsoft.DocAsCode.DataContracts.Common/JTokenConverter.cs +++ b/src/Microsoft.DocAsCode.DataContracts.Common/JTokenConverter.cs @@ -14,9 +14,9 @@ public static T Convert<T>(object obj) return (T)obj; } - if (obj is JToken jtoken) + if (obj is JToken jToken) { - return jtoken.ToObject<T>(); + return jToken.ToObject<T>(); } throw new InvalidCastException(); } diff --git a/src/Microsoft.DocAsCode.Dotnet/MetadataJsonConfig.cs b/src/Microsoft.DocAsCode.Dotnet/MetadataJsonConfig.cs index 5ae9629b926..5fc7d2f0abe 100644 --- a/src/Microsoft.DocAsCode.Dotnet/MetadataJsonConfig.cs +++ b/src/Microsoft.DocAsCode.Dotnet/MetadataJsonConfig.cs @@ -59,7 +59,7 @@ internal class MetadataJsonItemConfig /// <summary> /// An optional set of MSBuild properties used when interpreting project files. These - /// are the same properties that are passed to msbuild via the /property:<n>=<v> + /// are the same properties that are passed to MSBuild via the /property:<n>=<v> /// command line argument. /// </summary> [JsonProperty("properties")] diff --git a/src/Microsoft.DocAsCode.Dotnet/Parsers/XmlComment.cs b/src/Microsoft.DocAsCode.Dotnet/Parsers/XmlComment.cs index d0ce0fb1a4a..99eedbbd8e6 100644 --- a/src/Microsoft.DocAsCode.Dotnet/Parsers/XmlComment.cs +++ b/src/Microsoft.DocAsCode.Dotnet/Parsers/XmlComment.cs @@ -83,7 +83,7 @@ private XmlComment(string xml, XmlCommentParserContext context) Remarks = GetSingleNodeValue(nav, "/member/remarks"); Returns = GetSingleNodeValue(nav, "/member/returns"); - Exceptions = ToListNullOnEmpty(GetMulitpleCrefInfo(nav, "/member/exception")); + Exceptions = ToListNullOnEmpty(GetMultipleCrefInfo(nav, "/member/exception")); SeeAlsos = ToListNullOnEmpty(GetMultipleLinkInfo(nav, "/member/seealso")); Examples = GetMultipleExampleNodes(nav, "/member/example").ToList(); Parameters = GetListContent(nav, "/member/param", "parameter", context); @@ -372,7 +372,7 @@ private IEnumerable<string> GetMultipleExampleNodes(XPathNavigator navigator, st } } - private IEnumerable<ExceptionInfo> GetMulitpleCrefInfo(XPathNavigator navigator, string selector) + private IEnumerable<ExceptionInfo> GetMultipleCrefInfo(XPathNavigator navigator, string selector) { var iterator = navigator.Clone().Select(selector); if (iterator == null) @@ -563,7 +563,7 @@ static string HandleBlockQuote(string xml) static void DecodeMarkdownCode(MarkdownObject node) { - // Commonmark: Entity and numeric character references are treated as literal text in code spans and code blocks + // CommonMark: Entity and numeric character references are treated as literal text in code spans and code blocks switch (node) { case CodeInline codeInline: diff --git a/src/Microsoft.DocAsCode.Dotnet/SymbolUrlResolver.MSLearn.cs b/src/Microsoft.DocAsCode.Dotnet/SymbolUrlResolver.MSLearn.cs index 68b49f6e9f9..b01fa23f880 100644 --- a/src/Microsoft.DocAsCode.Dotnet/SymbolUrlResolver.MSLearn.cs +++ b/src/Microsoft.DocAsCode.Dotnet/SymbolUrlResolver.MSLearn.cs @@ -80,7 +80,7 @@ internal static string GetUrlFragmentFromUid(string uid) // Prettify URL fragment from UID: // // - Transform to lower case - // - Transform special charactors: + // - Transform special characters: // - Map <> [] {} to () () (()) // - Keep a-z, 0-9, ()*@ // - Drop "'%^\ diff --git a/src/Microsoft.DocAsCode.Dotnet/Visitors/SymbolVisitorAdapter.cs b/src/Microsoft.DocAsCode.Dotnet/Visitors/SymbolVisitorAdapter.cs index f523ebf6b3f..430c8ebe35a 100644 --- a/src/Microsoft.DocAsCode.Dotnet/Visitors/SymbolVisitorAdapter.cs +++ b/src/Microsoft.DocAsCode.Dotnet/Visitors/SymbolVisitorAdapter.cs @@ -369,8 +369,8 @@ public string AddReference(ISymbol symbol) var memberType = GetMemberTypeFromSymbol(symbol); if (memberType == MemberType.Default) { - Debug.Fail("Unexpected membertype."); - throw new InvalidOperationException("Unexpected membertype."); + Debug.Fail("Unexpected member type."); + throw new InvalidOperationException("Unexpected member type."); } return _generator.AddReference(symbol, _references, this); } @@ -406,8 +406,8 @@ public string AddOverloadReference(ISymbol symbol) case MemberType.Operator: return _generator.AddOverloadReference(symbol, _references, this); default: - Debug.Fail("Unexpected membertype."); - throw new InvalidOperationException("Unexpected membertype."); + Debug.Fail("Unexpected member type."); + throw new InvalidOperationException("Unexpected member type."); } } @@ -546,7 +546,7 @@ private void GenerateInheritance(INamedTypeSymbol symbol, MetadataItem item) var type = symbol; var inheritance = new List<string>(); dict = new Dictionary<string, string>(); - var typeParamterNames = symbol.IsGenericType ? symbol.Accept(TypeGenericParameterNameVisitor.Instance) : EmptyListOfString; + var typeParameterNames = symbol.IsGenericType ? symbol.Accept(TypeGenericParameterNameVisitor.Instance) : EmptyListOfString; while (type != null) { // TODO: special handles for errorType: change to System.Object @@ -558,10 +558,10 @@ private void GenerateInheritance(INamedTypeSymbol symbol, MetadataItem item) if (!type.Equals(symbol, SymbolEqualityComparer.Default)) { - inheritance.Add(AddSpecReference(type, typeParamterNames)); + inheritance.Add(AddSpecReference(type, typeParameterNames)); } - AddInheritedMembers(symbol, type, dict, typeParamterNames); + AddInheritedMembers(symbol, type, dict, typeParameterNames); type = type.BaseType; } @@ -574,7 +574,7 @@ private void GenerateInheritance(INamedTypeSymbol symbol, MetadataItem item) { item.Implements = (from t in symbol.AllInterfaces where _filter.IncludeApi(t) - select AddSpecReference(t, typeParamterNames)).ToList(); + select AddSpecReference(t, typeParameterNames)).ToList(); if (item.Implements.Count == 0) { item.Implements = null; @@ -584,11 +584,11 @@ where _filter.IncludeApi(t) else if (symbol.TypeKind == TypeKind.Interface) { dict = new Dictionary<string, string>(); - var typeParamterNames = symbol.IsGenericType ? symbol.Accept(TypeGenericParameterNameVisitor.Instance) : EmptyListOfString; - AddInheritedMembers(symbol, symbol, dict, typeParamterNames); + var typeParameterNames = symbol.IsGenericType ? symbol.Accept(TypeGenericParameterNameVisitor.Instance) : EmptyListOfString; + AddInheritedMembers(symbol, symbol, dict, typeParameterNames); for (int i = 0; i < symbol.AllInterfaces.Length; i++) { - AddInheritedMembers(symbol, symbol.AllInterfaces[i], dict, typeParamterNames); + AddInheritedMembers(symbol, symbol.AllInterfaces[i], dict, typeParameterNames); } } if (dict != null) @@ -658,7 +658,7 @@ private void GenerateExtensionMethods(INamedTypeSymbol symbol, MetadataItem item item.ExtensionMethods = extensions.Count > 0 ? extensions : null; } - private void AddInheritedMembers(INamedTypeSymbol symbol, INamedTypeSymbol type, Dictionary<string, string> dict, IReadOnlyList<string> typeParamterNames) + private void AddInheritedMembers(INamedTypeSymbol symbol, INamedTypeSymbol type, Dictionary<string, string> dict, IReadOnlyList<string> typeParameterNames) { foreach (var m in from m in type.GetMembers() where !(m is INamedTypeSymbol) @@ -667,10 +667,10 @@ where _filter.IncludeApi(m) where IsInheritable(m) select m) { - var sig = MemberSigRegex.Replace(SpecIdHelper.GetSpecId(m, typeParamterNames), string.Empty); + var sig = MemberSigRegex.Replace(SpecIdHelper.GetSpecId(m, typeParameterNames), string.Empty); if (!dict.ContainsKey(sig)) { - dict.Add(sig, type.Equals(symbol, SymbolEqualityComparer.Default) ? null : AddSpecReference(m, typeParamterNames)); + dict.Add(sig, type.Equals(symbol, SymbolEqualityComparer.Default) ? null : AddSpecReference(m, typeParameterNames)); } } } diff --git a/src/Microsoft.DocAsCode.Glob/FileGlob.cs b/src/Microsoft.DocAsCode.Glob/FileGlob.cs index e0cc010d475..9c9b44b3e91 100644 --- a/src/Microsoft.DocAsCode.Glob/FileGlob.cs +++ b/src/Microsoft.DocAsCode.Glob/FileGlob.cs @@ -61,11 +61,11 @@ private static IEnumerable<string> GetFilesFromSubfolder(string baseDirectory, s private static string GetRelativeFilePath(string directory, string file) { - var subpath = file.Substring(directory.Length); + var subPath = file.Substring(directory.Length); // directory could be // 1. root folder, e.g. E:\ or / // 2. sub folder, e.g. a or a/ or a\ - return subpath.TrimStart('\\', '/'); + return subPath.TrimStart('\\', '/'); } private static string GetRelativeDirectoryPath(string parentDirectory, string directory) diff --git a/src/Microsoft.DocAsCode.Glob/GlobMatcher.cs b/src/Microsoft.DocAsCode.Glob/GlobMatcher.cs index a36da371995..7bf4b260d0b 100644 --- a/src/Microsoft.DocAsCode.Glob/GlobMatcher.cs +++ b/src/Microsoft.DocAsCode.Glob/GlobMatcher.cs @@ -643,9 +643,9 @@ public override List<StringBuilder> Flatten() { foreach (StringBuilder sb in result) { - StringBuilder newsb = new(sb.ToString()); - newsb.Append(builder.ToString()); - tmp.Add(newsb); + StringBuilder newSb = new(sb.ToString()); + newSb.Append(builder.ToString()); + tmp.Add(newSb); } } result = tmp; diff --git a/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/HtmlNotInTocTransformer.cs b/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/HtmlNotInTocTransformer.cs index 8a75de5b642..d0db1c94cf9 100644 --- a/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/HtmlNotInTocTransformer.cs +++ b/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/HtmlNotInTocTransformer.cs @@ -24,7 +24,7 @@ public HtmlNotInTocTransformer(string basePath, UrlCache manifestUrlCache, PdfOp } /// <summary> - /// 1. Retrive <a href=''></a> from each html. + /// 1. Retrieve <a href=''></a> from each html. /// 2. Foreach link, try to fix it. /// 2.1 If the link is full path, just keep it. /// 2.2 If the link is root path(/a/b), just add host in prefix. @@ -34,7 +34,7 @@ public HtmlNotInTocTransformer(string basePath, UrlCache manifestUrlCache, PdfOp /// 2.3.3 If the link NOT in TOC and NOT in Manifest, log warning to the invalid link. /// 2.4 Others, keep it as the origin. /// </summary> - /// <param name="htmlFilePaths">The htmls' relative path in TOC.</param> + /// <param name="htmlFilePaths">The html's relative path in TOC.</param> public void Transform(IEnumerable<string> htmlFilePaths) { Guard.ArgumentNotNull(htmlFilePaths, nameof(htmlFilePaths)); diff --git a/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/RemoveQueryStringTransformer.cs b/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/RemoveQueryStringTransformer.cs index 774c60ebe22..8b2963df4e2 100644 --- a/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/RemoveQueryStringTransformer.cs +++ b/src/Microsoft.DocAsCode.HtmlToPdf/Transformer/RemoveQueryStringTransformer.cs @@ -28,11 +28,11 @@ public void Transform(IEnumerable<string> htmlFilePaths) foreach (var tag in tags) { var src = tag.Attributes["href"].Value; - var resovedUrl = src.RemoveUrlQueryString(); + var resolvedUrl = src.RemoveUrlQueryString(); - if (src != resovedUrl) + if (src != resolvedUrl) { - tag.Attributes["href"].Value = string.IsNullOrEmpty(resovedUrl) ? "#" : resovedUrl; + tag.Attributes["href"].Value = string.IsNullOrEmpty(resolvedUrl) ? "#" : resolvedUrl; isTransformed = true; } } diff --git a/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/CodeSnippetExtractor.cs b/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/CodeSnippetExtractor.cs index 68bf6827f8d..7055ed5c1b9 100644 --- a/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/CodeSnippetExtractor.cs +++ b/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/CodeSnippetExtractor.cs @@ -63,14 +63,14 @@ public Dictionary<string, CodeRange> GetAllTags(string[] lines, ref HashSet<int> return result; } - private bool MatchTag(string line, string template, out string tagName, bool containTagname = true) + private bool MatchTag(string line, string template, out string tagName, bool containTagName = true) { tagName = string.Empty; if (string.IsNullOrEmpty(line) || string.IsNullOrEmpty(template)) return false; - var splitedTemplate = template.Split(new[] { TagNamePlaceHolder }, StringSplitOptions.None); - var beforeTagName = splitedTemplate[0]; - var afterTagName = splitedTemplate.Length == 2 ? splitedTemplate[1] : string.Empty; + var splittedTemplate = template.Split(new[] { TagNamePlaceHolder }, StringSplitOptions.None); + var beforeTagName = splittedTemplate[0]; + var afterTagName = splittedTemplate.Length == 2 ? splittedTemplate[1] : string.Empty; int column = 0; int index = 0; @@ -112,6 +112,6 @@ private bool MatchTag(string line, string template, out string tagName, bool con if (index != afterTagName.Length) return false; while (column < line.Length && CharHelper.IsWhitespace(line[column])) column++; - return column == line.Length && (!containTagname || TagnameFormat.IsMatch(tagName)); + return column == line.Length && (!containTagName || TagnameFormat.IsMatch(tagName)); } } diff --git a/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/HtmlCodeSnippetRenderer.cs b/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/HtmlCodeSnippetRenderer.cs index 99442eeae6c..05aab64b8f9 100644 --- a/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/HtmlCodeSnippetRenderer.cs +++ b/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/CodeSnippet/HtmlCodeSnippetRenderer.cs @@ -75,7 +75,7 @@ public class HtmlCodeSnippetRenderer : HtmlObjectRenderer<CodeSnippet> { "csharp", new string[] {"cs"} }, { "cuda", new string[] {"cu", "cuh" } }, { "d", new string[] {"dlang"} }, - { "everything", new string[] {"example" } }, //this is the catch all to try and process unforseen languages + { "everything", new string[] {"example" } }, //this is the catch all to try and process unforeseen languages { "erlang", new string[] {"erl" } }, { "fsharp", new string[] {"fs", "fsi", "fsx" } }, { "go", new string[] {"golang" } }, @@ -300,9 +300,9 @@ public string GetContent(string content, CodeSnippet obj) foreach (var extractor in extractors) { HashSet<int> tagLines = new(); - var tagToCoderangeMapping = extractor.GetAllTags(allLines, ref tagLines); - if (tagToCoderangeMapping.TryGetValue(obj.TagName, out var cr) - || tagToCoderangeMapping.TryGetValue(tagWithPrefix, out cr)) + var tagToCodeRangeMapping = extractor.GetAllTags(allLines, ref tagLines); + if (tagToCodeRangeMapping.TryGetValue(obj.TagName, out var cr) + || tagToCodeRangeMapping.TryGetValue(tagWithPrefix, out cr)) { return GetCodeLines(allLines, obj, new List<CodeRange> { cr }, tagLines); } diff --git a/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/TripleColon/ZoneExtension.cs b/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/TripleColon/ZoneExtension.cs index 5632f094a7b..5fc881a4735 100644 --- a/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/TripleColon/ZoneExtension.cs +++ b/src/Microsoft.DocAsCode.MarkdigEngine.Extensions/TripleColon/ZoneExtension.cs @@ -56,7 +56,7 @@ public bool TryProcessAttributes(IDictionary<string, string> attributes, out Htm if (target == string.Empty && pivot == string.Empty) { - logError("Either target or privot must be specified."); + logError("Either target or pivot must be specified."); return false; } if (target == "pdf" && pivot != string.Empty) diff --git a/src/Microsoft.DocAsCode.MarkdigEngine/Validation/MarkdownValidatorBuilder.cs b/src/Microsoft.DocAsCode.MarkdigEngine/Validation/MarkdownValidatorBuilder.cs index 7e3d9a1f251..496c40ec38e 100644 --- a/src/Microsoft.DocAsCode.MarkdigEngine/Validation/MarkdownValidatorBuilder.cs +++ b/src/Microsoft.DocAsCode.MarkdigEngine/Validation/MarkdownValidatorBuilder.cs @@ -171,17 +171,17 @@ private static void LoadValidatorConfig(string baseDir, string templateDir, Mark if (templateDir != null) { - var configFolder = Path.Combine(templateDir, MarkdownSytleDefinition.MarkdownStyleDefinitionFolderName); + var configFolder = Path.Combine(templateDir, MarkdownStyleDefinition.MarkdownStyleDefinitionFolderName); if (Directory.Exists(configFolder)) { LoadValidatorDefinition(configFolder, builder); } } - var configFile = Path.Combine(baseDir, MarkdownSytleConfig.MarkdownStyleFileName); + var configFile = Path.Combine(baseDir, MarkdownStyleConfig.MarkdownStyleFileName); if (EnvironmentContext.FileAbstractLayer.Exists(configFile)) { - var config = JsonUtility.Deserialize<MarkdownSytleConfig>(configFile); + var config = JsonUtility.Deserialize<MarkdownStyleConfig>(configFile); builder.AddValidators(config.Rules); builder.AddTagValidators(config.TagRules); builder.AddSettings(config.Settings); @@ -193,11 +193,11 @@ private static void LoadValidatorDefinition(string mdStyleDefPath, MarkdownValid { if (Directory.Exists(mdStyleDefPath)) { - foreach (var configFile in Directory.GetFiles(mdStyleDefPath, "*" + MarkdownSytleDefinition.MarkdownStyleDefinitionFilePostfix)) + foreach (var configFile in Directory.GetFiles(mdStyleDefPath, "*" + MarkdownStyleDefinition.MarkdownStyleDefinitionFilePostfix)) { var fileName = Path.GetFileName(configFile); - var category = fileName.Remove(fileName.Length - MarkdownSytleDefinition.MarkdownStyleDefinitionFilePostfix.Length); - var config = JsonUtility.Deserialize<MarkdownSytleDefinition>(configFile); + var category = fileName.Remove(fileName.Length - MarkdownStyleDefinition.MarkdownStyleDefinitionFilePostfix.Length); + var config = JsonUtility.Deserialize<MarkdownStyleDefinition>(configFile); builder.AddTagValidators(category, config.TagRules); builder.AddValidators(category, config.Rules); } diff --git a/src/Microsoft.DocAsCode.MarkdigEngine/YamlHeader/YamlHeaderRenderer.cs b/src/Microsoft.DocAsCode.MarkdigEngine/YamlHeader/YamlHeaderRenderer.cs index d28c454cabe..6f1c2e0e811 100644 --- a/src/Microsoft.DocAsCode.MarkdigEngine/YamlHeader/YamlHeaderRenderer.cs +++ b/src/Microsoft.DocAsCode.MarkdigEngine/YamlHeader/YamlHeaderRenderer.cs @@ -41,7 +41,7 @@ protected override void Write(HtmlRenderer renderer, YamlFrontMatterBlock obj) } catch (Exception ex) { - // not a valid ymlheader, do nothing + // not a valid yml header, do nothing _context.LogWarning("invalid-yaml-header", ex.Message, obj); } } diff --git a/src/Microsoft.DocAsCode.Plugins/ManifestItemCollectionConverter.cs b/src/Microsoft.DocAsCode.Plugins/ManifestItemCollectionConverter.cs index 04915970bfe..dd4698d0b0f 100644 --- a/src/Microsoft.DocAsCode.Plugins/ManifestItemCollectionConverter.cs +++ b/src/Microsoft.DocAsCode.Plugins/ManifestItemCollectionConverter.cs @@ -12,7 +12,7 @@ public override bool CanConvert(Type objectType) return objectType == typeof(ManifestItemCollection); } - public override object ReadJson(JsonReader reader, Type objecType, object existingValue, + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var manifestCollectionList = (List<ManifestItem>)serializer.Deserialize(reader, typeof(List<ManifestItem>)); diff --git a/src/Microsoft.DocAsCode.Plugins/MarkdownSytleConfig.cs b/src/Microsoft.DocAsCode.Plugins/MarkdownStyleConfig.cs similarity index 95% rename from src/Microsoft.DocAsCode.Plugins/MarkdownSytleConfig.cs rename to src/Microsoft.DocAsCode.Plugins/MarkdownStyleConfig.cs index ed8e1e695c2..534b7eeacfb 100644 --- a/src/Microsoft.DocAsCode.Plugins/MarkdownSytleConfig.cs +++ b/src/Microsoft.DocAsCode.Plugins/MarkdownStyleConfig.cs @@ -5,7 +5,7 @@ namespace Microsoft.DocAsCode.Plugins; -public class MarkdownSytleConfig +public class MarkdownStyleConfig { public const string MarkdownStyleFileName = "md.style"; diff --git a/src/Microsoft.DocAsCode.Plugins/MarkdownSytleDefinition.cs b/src/Microsoft.DocAsCode.Plugins/MarkdownSytleDefinition.cs index a0722b6c81a..ba5bdd17e9e 100644 --- a/src/Microsoft.DocAsCode.Plugins/MarkdownSytleDefinition.cs +++ b/src/Microsoft.DocAsCode.Plugins/MarkdownSytleDefinition.cs @@ -5,7 +5,7 @@ namespace Microsoft.DocAsCode.Plugins; -public class MarkdownSytleDefinition +public class MarkdownStyleDefinition { public const string MarkdownStyleDefinitionFilePostfix = ".md.style"; public const string MarkdownStyleDefinitionFolderName = "md.styles"; diff --git a/src/Microsoft.DocAsCode.YamlSerialization/Helpers/ReflectionUtility.cs b/src/Microsoft.DocAsCode.YamlSerialization/Helpers/ReflectionUtility.cs index 6502c1b24c0..cb532c5234d 100644 --- a/src/Microsoft.DocAsCode.YamlSerialization/Helpers/ReflectionUtility.cs +++ b/src/Microsoft.DocAsCode.YamlSerialization/Helpers/ReflectionUtility.cs @@ -7,11 +7,11 @@ internal static class ReflectionUtility { public static Type GetImplementedGenericInterface(Type type, Type genericInterfaceType) { - foreach (var interfacetype in GetImplementedInterfaces(type)) + foreach (var interfaceType in GetImplementedInterfaces(type)) { - if (interfacetype.IsGenericType && interfacetype.GetGenericTypeDefinition() == genericInterfaceType) + if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == genericInterfaceType) { - return interfacetype; + return interfaceType; } } return null; diff --git a/src/Microsoft.DocAsCode.YamlSerialization/TypeInspectors/EmitTypeInspector.cs b/src/Microsoft.DocAsCode.YamlSerialization/TypeInspectors/EmitTypeInspector.cs index 5404521c9f9..6783f763345 100644 --- a/src/Microsoft.DocAsCode.YamlSerialization/TypeInspectors/EmitTypeInspector.cs +++ b/src/Microsoft.DocAsCode.YamlSerialization/TypeInspectors/EmitTypeInspector.cs @@ -29,20 +29,20 @@ public override IEnumerable<IPropertyDescriptor> GetProperties(Type type, object { throw item.Error; } - if (container == null || item.ExtensibleProperies.Count == 0) + if (container == null || item.ExtensibleProperties.Count == 0) { // all static information return _propertyDescriptorCache.GetOrAdd(type, GetPropertyDescriptors(item).ToList()); } return GetPropertyDescriptors(item).Concat( - from ep in item.ExtensibleProperies + from ep in item.ExtensibleProperties from key in ep.GetAllKeys(container) ?? Enumerable.Empty<string>() select new ExtensiblePropertyDescriptor(ep, ep.Prefix + key, _resolver)); } private IEnumerable<IPropertyDescriptor> GetPropertyDescriptors(CachingItem item) { - return from p in item.Properies select new EmitPropertyDescriptor(p, _resolver); + return from p in item.Properties select new EmitPropertyDescriptor(p, _resolver); } public override IPropertyDescriptor GetProperty(Type type, object container, string name) @@ -52,11 +52,11 @@ public override IPropertyDescriptor GetProperty(Type type, object container, str { throw item.Error; } - if (item.ExtensibleProperies.Count == 0) + if (item.ExtensibleProperties.Count == 0) { return null; } - return (from ep in item.ExtensibleProperies + return (from ep in item.ExtensibleProperties where name.StartsWith(ep.Prefix, StringComparison.Ordinal) select new ExtensiblePropertyDescriptor(ep, name, _resolver)).FirstOrDefault(); } @@ -67,9 +67,9 @@ private CachingItem() { } public Exception Error { get; private set; } - public List<EmitPropertyDescriptorSkeleton> Properies { get; } = new List<EmitPropertyDescriptorSkeleton>(); + public List<EmitPropertyDescriptorSkeleton> Properties { get; } = new List<EmitPropertyDescriptorSkeleton>(); - public List<ExtensiblePropertyDescriptorSkeleton> ExtensibleProperies { get; } = new List<ExtensiblePropertyDescriptorSkeleton>(); + public List<ExtensiblePropertyDescriptorSkeleton> ExtensibleProperties { get; } = new List<ExtensiblePropertyDescriptorSkeleton>(); public static CachingItem Create(Type type) { @@ -91,7 +91,7 @@ public static CachingItem Create(Type type) if (extAttr == null) { var setMethod = prop.GetSetMethod(); - result.Properies.Add(new EmitPropertyDescriptorSkeleton + result.Properties.Add(new EmitPropertyDescriptorSkeleton { CanWrite = setMethod != null, Name = prop.Name, @@ -111,7 +111,7 @@ public static CachingItem Create(Type type) return result; } - result.ExtensibleProperies.Add( + result.ExtensibleProperties.Add( new ExtensiblePropertyDescriptorSkeleton { KeyReader = CreateDictionaryKeyReader(getMethod, valueType), @@ -124,7 +124,7 @@ public static CachingItem Create(Type type) } // order by the length of Prefix descending. - result.ExtensibleProperies.Sort((left, right) => right.Prefix.Length - left.Prefix.Length); + result.ExtensibleProperties.Sort((left, right) => right.Prefix.Length - left.Prefix.Length); return result; } diff --git a/src/docfx/Models/BuildCommandOptions.cs b/src/docfx/Models/BuildCommandOptions.cs index 458415210a8..306e03187b9 100644 --- a/src/docfx/Models/BuildCommandOptions.cs +++ b/src/docfx/Models/BuildCommandOptions.cs @@ -97,7 +97,7 @@ internal class BuildCommandOptions : LogOptions [TypeConverter(typeof(ArrayOptionConverter))] public IEnumerable<string> PostProcessors { get; set; } - [Description("If set to true, docfx does not dereference (aka. copy) file to the output folder, instead, it saves a link_to_path property inside mainfiest.json to indicate the physical location of that file.")] + [Description("If set to true, docfx does not dereference (aka. copy) file to the output folder, instead, it saves a link_to_path property inside manifest.json to indicate the physical location of that file.")] [CommandOption("--keepFileLink")] public bool KeepFileLink { get; set; } diff --git a/src/docfx/Models/InitCommand.cs b/src/docfx/Models/InitCommand.cs index ace3f752f7c..683cbee482d 100644 --- a/src/docfx/Models/InitCommand.cs +++ b/src/docfx/Models/InitCommand.cs @@ -287,7 +287,7 @@ private static void SaveConfigFile(string path, object config) private static bool ProcessOverwriteQuestion(string message, bool quiet, bool overwriteResult) { - bool overwrited = true; + bool overwritten = true; IQuestion overwriteQuestion; if (overwriteResult) @@ -298,7 +298,7 @@ private static bool ProcessOverwriteQuestion(string message, bool quiet, bool ov { if (!s) { - overwrited = false; + overwritten = false; } }); } @@ -310,14 +310,14 @@ private static bool ProcessOverwriteQuestion(string message, bool quiet, bool ov { if (!s) { - overwrited = false; + overwritten = false; } }); } - overwriteQuestion.Process(null, new QuestionContext { NeedWarning = overwrited, Quiet = quiet }); + overwriteQuestion.Process(null, new QuestionContext { NeedWarning = overwritten, Quiet = quiet }); - return overwrited; + return overwritten; } #region Question classes diff --git a/src/docfx/Models/MetadataCommandOptions.cs b/src/docfx/Models/MetadataCommandOptions.cs index 988755f7775..666507c4392 100644 --- a/src/docfx/Models/MetadataCommandOptions.cs +++ b/src/docfx/Models/MetadataCommandOptions.cs @@ -29,7 +29,7 @@ internal class MetadataCommandOptions : LogOptions [CommandOption("--globalNamespaceId")] public string GlobalNamespaceId { get; set; } - [Description("--property <n1>=<v1>;<n2>=<v2> An optional set of MSBuild properties used when interpreting project files. These are the same properties that are passed to msbuild via the /property:<n1>=<v1>;<n2>=<v2> command line argument")] + [Description("--property <n1>=<v1>;<n2>=<v2> An optional set of MSBuild properties used when interpreting project files. These are the same properties that are passed to MSBuild via the /property:<n1>=<v1>;<n2>=<v2> command line argument")] [CommandOption("--property")] public string MSBuildProperties { get; set; } diff --git a/test/Microsoft.DocAsCode.Build.Engine.Tests/DocumentBuilderTest.cs b/test/Microsoft.DocAsCode.Build.Engine.Tests/DocumentBuilderTest.cs index 6f86ac68c99..702736b1630 100644 --- a/test/Microsoft.DocAsCode.Build.Engine.Tests/DocumentBuilderTest.cs +++ b/test/Microsoft.DocAsCode.Build.Engine.Tests/DocumentBuilderTest.cs @@ -140,10 +140,10 @@ public void TestBuild() " c: e", "---", "# Hello World", - "Test xrefmap with duplicate uid in different fiels: XRef2 should be recorded with file test/test.md" + "Test xrefmap with duplicate uid in different files: XRef2 should be recorded with file test/test.md" }, _inputFolder); - File.WriteAllText(MarkdownSytleConfig.MarkdownStyleFileName, @"{ + File.WriteAllText(MarkdownStyleConfig.MarkdownStyleFileName, @"{ rules : [ ""foo"", { name: ""bar"", disable: true} @@ -397,14 +397,14 @@ public void TestMarkdownStyleInPlugins() _inputFolder); File.WriteAllText(resourceMetaFile, @"{ abc: ""xyz"", uid: ""r1"" }"); - File.WriteAllText(MarkdownSytleConfig.MarkdownStyleFileName, @"{ + File.WriteAllText(MarkdownStyleConfig.MarkdownStyleFileName, @"{ settings : [ { category: ""div"", disable: true}, { category: ""p"", id: ""p-3"", disable: true} ], }"); CreateFile( - MarkdownSytleDefinition.MarkdownStyleDefinitionFolderName + "/p" + MarkdownSytleDefinition.MarkdownStyleDefinitionFilePostfix, + MarkdownStyleDefinition.MarkdownStyleDefinitionFolderName + "/p" + MarkdownStyleDefinition.MarkdownStyleDefinitionFilePostfix, @"{ tagRules : { ""p-1"": { @@ -430,7 +430,7 @@ public void TestMarkdownStyleInPlugins() } ", _templateFolder); CreateFile( - MarkdownSytleDefinition.MarkdownStyleDefinitionFolderName + "/div" + MarkdownSytleDefinition.MarkdownStyleDefinitionFilePostfix, + MarkdownStyleDefinition.MarkdownStyleDefinitionFolderName + "/div" + MarkdownStyleDefinition.MarkdownStyleDefinitionFilePostfix, @"{ tagRules : { ""div-1"": { diff --git a/test/Microsoft.DocAsCode.Build.Engine.Tests/TemplateManagerUnitTest.cs b/test/Microsoft.DocAsCode.Build.Engine.Tests/TemplateManagerUnitTest.cs index db12f4b682b..7d243e095c5 100644 --- a/test/Microsoft.DocAsCode.Build.Engine.Tests/TemplateManagerUnitTest.cs +++ b/test/Microsoft.DocAsCode.Build.Engine.Tests/TemplateManagerUnitTest.cs @@ -23,12 +23,12 @@ public TemplateManagerUnitTest() [Trait("Related", "ResourceFinder")] [Fact] - public void TestTemplateManagerWithMutipleThemesShouldWork() + public void TestTemplateManagerWithMultipleThemesShouldWork() { - // If the same resource name exists in the override folder, use the overriden one + // If the same resource name exists in the override folder, use the overridden one var themes = new List<string> { "tmpl1", "tmpl/tmpl1" }; var manager = new TemplateManager(null, themes, null); - var outputFolder = Path.Combine(_outputFolder, "TestTemplateManager_MutipleThemes"); + var outputFolder = Path.Combine(_outputFolder, "TestTemplateManager_MultipleThemes"); manager.ProcessTheme(outputFolder, true); // 1. Support tmpl1.zip var file1 = Path.Combine(outputFolder, "tmpl1.dot.$"); diff --git a/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefArchiveBuilderTest.cs b/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefArchiveBuilderTest.cs index b6641899dd0..f34e7fc3363 100644 --- a/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefArchiveBuilderTest.cs +++ b/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefArchiveBuilderTest.cs @@ -5,7 +5,7 @@ namespace Microsoft.DocAsCode.Build.Engine.Tests; -[Trait("Related", "XRefAtchive")] +[Trait("Related", "XRefArchive")] public class XRefArchiveBuilderTest { [Fact] diff --git a/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefMapDownloaderTest.cs b/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefMapDownloaderTest.cs index 6fd7721ffa4..267a6a8ce82 100644 --- a/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefMapDownloaderTest.cs +++ b/test/Microsoft.DocAsCode.Build.Engine.Tests/XRefMapDownloaderTest.cs @@ -8,7 +8,7 @@ namespace Microsoft.DocAsCode.Build.Engine.Tests; public class XRefMapDownloadTest { - [Fact(Skip = "Flakly SSL connection problems on GH windows CI")] + [Fact(Skip = "Flaky SSL connection problems on GH windows CI")] public async Task BaseUrlIsSet() { // GitHub doesn't support TLS 1.1 since Feb 23, 2018. See: https://github.com/blog/2507-weak-cryptographic-standards-removed diff --git a/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/MarkdownFragmentsCreaterTest.cs b/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/MarkdownFragmentsCreatorTest.cs similarity index 89% rename from test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/MarkdownFragmentsCreaterTest.cs rename to test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/MarkdownFragmentsCreatorTest.cs index 50ad98d97da..20d7af8dd60 100644 --- a/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/MarkdownFragmentsCreaterTest.cs +++ b/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/MarkdownFragmentsCreatorTest.cs @@ -7,14 +7,14 @@ namespace Microsoft.DocAsCode.Build.OverwriteDocuments.Tests; -public class MarkdownFragmentsCreaterTest +public class MarkdownFragmentsCreatorTest { [Fact] public void BaseTest() { var markdown = File.ReadAllText("TestData/System.String.yml.md"); var ast = Markdown.Parse(markdown); - var model = new MarkdownFragmentsCreater().Create(ast).ToList(); + var model = new MarkdownFragmentsCreator().Create(ast).ToList(); Assert.Equal(2, model.Count); Assert.Equal("System.String", model[0].Uid); @@ -41,7 +41,7 @@ markdown content "; var ast = Markdown.Parse(markdown); - var ex = Assert.Throws<MarkdownFragmentsException>(() => new MarkdownFragmentsCreater().Create(ast).ToList()); + var ex = Assert.Throws<MarkdownFragmentsException>(() => new MarkdownFragmentsCreator().Create(ast).ToList()); Assert.Equal("Expect L1InlineCodeHeading", ex.Message); Assert.Equal(0, ex.Position); } @@ -61,7 +61,7 @@ markdown content "; var ast = Markdown.Parse(markdown); - var ex = Assert.Throws<MarkdownFragmentsException>(() => new MarkdownFragmentsCreater().Create(ast).ToList()); + var ex = Assert.Throws<MarkdownFragmentsException>(() => new MarkdownFragmentsCreator().Create(ast).ToList()); Assert.Equal("Expect L1InlineCodeHeading", ex.Message); Assert.Equal(8, ex.Position); } @@ -80,7 +80,7 @@ public void YamlCodeBlockShouldBeNextToL1CodeHeading() ``` "; var ast = Markdown.Parse(markdown); - var model = new MarkdownFragmentsCreater().Create(ast).ToList(); + var model = new MarkdownFragmentsCreator().Create(ast).ToList(); Assert.Null(model[0].YamlCodeBlock); Assert.Null(model[0].YamlCodeBlockSource); diff --git a/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteDocumentModelCreaterTest.cs b/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteDocumentModelCreatorTest.cs similarity index 94% rename from test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteDocumentModelCreaterTest.cs rename to test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteDocumentModelCreatorTest.cs index 19672fed390..b8af10c3ac9 100644 --- a/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteDocumentModelCreaterTest.cs +++ b/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteDocumentModelCreatorTest.cs @@ -12,9 +12,9 @@ namespace Microsoft.DocAsCode.Build.OverwriteDocuments.Tests; -public class OverwriteDocumentModelCreaterTest +public class OverwriteDocumentModelCreatorTest { - private TestLoggerListener _listener = TestLoggerListener.CreateLoggerListenerWithPhaseEqualFilter("overwrite_document_model_creater"); + private TestLoggerListener _listener = TestLoggerListener.CreateLoggerListenerWithPhaseEqualFilter("overwrite_document_model_creator"); [Fact] public void YamlCodeBlockTest() @@ -28,7 +28,7 @@ public void YamlCodeBlockTest() - name: displayName description: overwrite in yaml block"; var testYamlCodeBlock = Markdown.Parse($"```\n{yamlCodeBlockString}\n```")[0]; - var actual = JObject.FromObject(OverwriteDocumentModelCreater.ConvertYamlCodeBlock(yamlCodeBlockString, testYamlCodeBlock)); + var actual = JObject.FromObject(OverwriteDocumentModelCreator.ConvertYamlCodeBlock(yamlCodeBlockString, testYamlCodeBlock)); Assert.Equal("name overwrite", actual["name"].ToString()); Assert.Equal("Application 1", actual["definitions"][0]["name"].ToString()); Assert.Equal("id", actual["definitions"][0]["properties"][0]["name"].ToString()); @@ -60,7 +60,7 @@ public void ContentConvertTest() }); } - var contentsMetadata = new OverwriteDocumentModelCreater("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents); + var contentsMetadata = new OverwriteDocumentModelCreator("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents); Assert.Equal(3, contentsMetadata.Count); Assert.Equal("summary,return,function", ExtractDictionaryKeys(contentsMetadata)); Assert.Equal(2, ((Dictionary<object, object>)contentsMetadata["return"]).Count); @@ -100,9 +100,9 @@ public void DuplicateOPathInMarkdownSectionTest() Logger.RegisterListener(_listener); try { - using (new LoggerPhaseScope("overwrite_document_model_creater")) + using (new LoggerPhaseScope("overwrite_document_model_creator")) { - contentsMetadata = new OverwriteDocumentModelCreater("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents); + contentsMetadata = new OverwriteDocumentModelCreator("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents); } } finally @@ -130,7 +130,7 @@ public void DuplicateOPathsInYamlCodeBlockAndContentsBlockTest() - name: displayName description: overwrite in yaml block"; var testYamlCodeBlock = Markdown.Parse($"```\n{yamlCodeBlockString}\n```")[0]; - var yamlMetadata = OverwriteDocumentModelCreater.ConvertYamlCodeBlock(yamlCodeBlockString, testYamlCodeBlock); + var yamlMetadata = OverwriteDocumentModelCreator.ConvertYamlCodeBlock(yamlCodeBlockString, testYamlCodeBlock); // Markdown section var testBlockList = Markdown.Parse("Test").ToList(); @@ -156,9 +156,9 @@ public void DuplicateOPathsInYamlCodeBlockAndContentsBlockTest() Logger.RegisterListener(_listener); try { - using (new LoggerPhaseScope("overwrite_document_model_creater")) + using (new LoggerPhaseScope("overwrite_document_model_creator")) { - metadata = new OverwriteDocumentModelCreater("test.yml.md").ConvertContents(yamlMetadata, contents); + metadata = new OverwriteDocumentModelCreator("test.yml.md").ConvertContents(yamlMetadata, contents); } } finally @@ -196,7 +196,7 @@ public void InvalidOPathsTest1() }); } - var ex = Assert.Throws<MarkdownFragmentsException>(() => new OverwriteDocumentModelCreater("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents)); + var ex = Assert.Throws<MarkdownFragmentsException>(() => new OverwriteDocumentModelCreator("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents)); Assert.Equal( "A(parameters) is not expected to be an array like \"A[c=d]/B\", however it is used as an array in line 0 with `parameters[id=\"para1\"]/...`", ex.Message); @@ -223,7 +223,7 @@ public void InvalidOPathsTest2() }); } - var ex = Assert.Throws<MarkdownFragmentsException>(() => new OverwriteDocumentModelCreater("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents)); + var ex = Assert.Throws<MarkdownFragmentsException>(() => new OverwriteDocumentModelCreator("test.yml.md").ConvertContents(new Dictionary<object, object>(), contents)); Assert.Equal( "A(parameters) is not expected to be an object like \"A/B\", however it is used as an object in line 0 with `parameters/...`", ex.Message); diff --git a/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteUtilityTest.cs b/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteUtilityTest.cs index d0259f95178..2f32de26e14 100644 --- a/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteUtilityTest.cs +++ b/test/Microsoft.DocAsCode.Build.OverwriteDocuments.Tests/OverwriteUtilityTest.cs @@ -10,8 +10,8 @@ public class OverwriteUtilityTest [Fact] public void ParseOPathTest() { - var OPathstring = "a/f[c= \"d\"]/g/b[c =\"d/d_d d\"]/e"; - var OPathSegments = OverwriteUtility.ParseOPath(OPathstring); + var OPathString = "a/f[c= \"d\"]/g/b[c =\"d/d_d d\"]/e"; + var OPathSegments = OverwriteUtility.ParseOPath(OPathString); Assert.Equal(5, OPathSegments.Count); Assert.Equal("a,f,g,b,e", OPathSegments.Select(o => o.SegmentName).Aggregate((a, b) => a + "," + b)); Assert.Equal("c", OPathSegments[1].Key); diff --git a/test/Microsoft.DocAsCode.Build.RestApi.Tests/RestApiDocumentProcessorTest.cs b/test/Microsoft.DocAsCode.Build.RestApi.Tests/RestApiDocumentProcessorTest.cs index 59e6a2e1a4f..6bc5a27dd6a 100644 --- a/test/Microsoft.DocAsCode.Build.RestApi.Tests/RestApiDocumentProcessorTest.cs +++ b/test/Microsoft.DocAsCode.Build.RestApi.Tests/RestApiDocumentProcessorTest.cs @@ -398,10 +398,10 @@ public void ProcessSwaggerWithInvalidOverwriteShouldFail() } [Fact] - public void ProcessSwaggerWithUnmergableOverwriteShouldSucceed() + public void ProcessSwaggerWithUnmergeableOverwriteShouldSucceed() { FileCollection files = new(_defaultFiles); - files.Add(DocumentType.Overwrite, new[] { "TestData/overwrite/rest.overwrite.unmergable.md" }); + files.Add(DocumentType.Overwrite, new[] { "TestData/overwrite/rest.overwrite.unmergeable.md" }); BuildDocument(files); { var outputRawModelPath = GetRawModelFilePath("contacts.json"); @@ -430,7 +430,7 @@ public void ProcessSwaggerWithMultiUidOverwriteShouldSucceed() { var files = new FileCollection(_defaultFiles); files.Add(DocumentType.Overwrite, new[] { "TestData/overwrite/rest.overwrite.multi.uid.md" }); - files.Add(DocumentType.Overwrite, new[] { "TestData/overwrite/rest.overwrite.unmergable.md" }); + files.Add(DocumentType.Overwrite, new[] { "TestData/overwrite/rest.overwrite.unmergeable.md" }); BuildDocument(files); { var outputRawModelPath = GetRawModelFilePath("contacts.json"); diff --git a/test/Microsoft.DocAsCode.Build.RestApi.Tests/SwaggerJsonParserTest.cs b/test/Microsoft.DocAsCode.Build.RestApi.Tests/SwaggerJsonParserTest.cs index 8530c09b5e3..b90a0fc8541 100644 --- a/test/Microsoft.DocAsCode.Build.RestApi.Tests/SwaggerJsonParserTest.cs +++ b/test/Microsoft.DocAsCode.Build.RestApi.Tests/SwaggerJsonParserTest.cs @@ -200,36 +200,36 @@ public void ParseKeyWordSwaggerJsonShouldSucceed() ///test responses/../examples: unresolved. var response200 = responses["200"] as JObject; - var examplesOfresponse200 = response200["examples"] as JObject; - Assert.NotNull(examplesOfresponse200["$ref"]); + var examplesOfResponse200 = response200["examples"] as JObject; + Assert.NotNull(examplesOfResponse200["$ref"]); ///test responses/examples: resolved. - var examplesOfresponse = responses["examples"] as JObject; - Assert.Null(examplesOfresponse["$ref"]); + var examplesOfResponse = responses["examples"] as JObject; + Assert.Null(examplesOfResponse["$ref"]); ///test parameters/examples: resolved. var parameters = get["parameters"] as JObject; - var examplesOfparameters = parameters["examples"] as JObject; - Assert.Null(examplesOfparameters["$ref"]); + var examplesOfParameters = parameters["examples"] as JObject; + Assert.Null(examplesOfParameters["$ref"]); ///test definitions/../example: unresolved. var definitions = swagger.Definitions as JObject; var tag = definitions["Tag"] as JObject; - var examplesOftag = tag["example"] as JObject; - Assert.NotNull(examplesOftag["$ref"]); + var examplesOfTag = tag["example"] as JObject; + Assert.NotNull(examplesOfTag["$ref"]); ///test definitions/example: resolved. - var examplesOfdefinitions = definitions["example"] as JObject; - Assert.Null(examplesOfdefinitions["$ref"]); + var examplesOfDefinitions = definitions["example"] as JObject; + Assert.Null(examplesOfDefinitions["$ref"]); ///test properties/../example: unresolved. - var propertiesOftag = tag["properties"] as JObject; - var unresolvedOftag = propertiesOftag["unresolved"] as JObject; - var examplesOfunresolved = unresolvedOftag["example"] as JObject; - Assert.NotNull(examplesOfunresolved["$ref"]); + var propertiesOfTag = tag["properties"] as JObject; + var unresolvedOfTag = propertiesOfTag["unresolved"] as JObject; + var examplesOfUnresolved = unresolvedOfTag["example"] as JObject; + Assert.NotNull(examplesOfUnresolved["$ref"]); ///test properties/example: resolved. - var examplesOfresolved = propertiesOftag["example"] as JObject; - Assert.Null(examplesOfresolved["$ref"]); + var examplesOfResolved = propertiesOfTag["example"] as JObject; + Assert.Null(examplesOfResolved["$ref"]); } } diff --git a/test/Microsoft.DocAsCode.Build.RestApi.Tests/TestData/overwrite/rest.overwrite.unmergable.md b/test/Microsoft.DocAsCode.Build.RestApi.Tests/TestData/overwrite/rest.overwrite.unmergeable.md similarity index 100% rename from test/Microsoft.DocAsCode.Build.RestApi.Tests/TestData/overwrite/rest.overwrite.unmergable.md rename to test/Microsoft.DocAsCode.Build.RestApi.Tests/TestData/overwrite/rest.overwrite.unmergeable.md diff --git a/test/Microsoft.DocAsCode.Build.RestApi.WithPlugins.Tests/SplitRestApiToOperationLevelTest.cs b/test/Microsoft.DocAsCode.Build.RestApi.WithPlugins.Tests/SplitRestApiToOperationLevelTest.cs index 90503274815..b7979bf43bc 100644 --- a/test/Microsoft.DocAsCode.Build.RestApi.WithPlugins.Tests/SplitRestApiToOperationLevelTest.cs +++ b/test/Microsoft.DocAsCode.Build.RestApi.WithPlugins.Tests/SplitRestApiToOperationLevelTest.cs @@ -83,7 +83,7 @@ public void SplitRestApiToOperationLevelShouldSucceed() var child = model.Children[0]; Assert.Equal("petstore.swagger.io/v2/Swagger Petstore/1.0.0/addPet/operation", child.Uid); Assert.Null(child.HtmlId); - Assert.Null(child.Summary); // Summary is poped to operation page + Assert.Null(child.Summary); // Summary is popped to operation page Assert.Empty(child.Tags); } } @@ -126,7 +126,7 @@ public void SplitRestApiToOperationLevelWithTocShouldSucceed() var child = model.Children[0]; Assert.Equal("petstore.swagger.io/v2/Swagger Petstore/1.0.0/addPet/operation", child.Uid); Assert.Null(child.HtmlId); - Assert.Null(child.Summary); // Summary has been poped to operation page + Assert.Null(child.Summary); // Summary has been popped to operation page Assert.Empty(child.Tags); } { @@ -202,7 +202,7 @@ public void SplitRestApiToTagAndOperationLevelWithTocShouldSucceed() var child = model.Children[0]; Assert.Equal("petstore.swagger.io/v2/Swagger Petstore/1.0.0/addPet/operation", child.Uid); Assert.Null(child.HtmlId); - Assert.Null(child.Summary); // Summary has been poped to operation page + Assert.Null(child.Summary); // Summary has been popped to operation page Assert.Empty(child.Tags); } { diff --git a/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/LimitationReachedTest.cs b/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/LimitationReachedTest.cs index 11564259fca..afdf504550b 100644 --- a/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/LimitationReachedTest.cs +++ b/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/LimitationReachedTest.cs @@ -42,7 +42,7 @@ public LimitationReachedTest() _templateManager = new TemplateManager(new List<string> { "template" }, null, _templateFolder); } - [Fact(Skip = "Mannually run this testcase, as it will influence the result of other test cases")] + [Fact(Skip = "Manually run this testcase, as it will influence the result of other test cases")] public void TestSchemaReachedLimits() { // Json.NET schema has limitation of 1000 calls per hour diff --git a/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/MarkdownFragmentsValidationTest.cs b/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/MarkdownFragmentsValidationTest.cs index 354e0c03c2a..3efa4dc44ed 100644 --- a/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/MarkdownFragmentsValidationTest.cs +++ b/test/Microsoft.DocAsCode.Build.SchemaDriven.Tests/MarkdownFragmentsValidationTest.cs @@ -28,7 +28,7 @@ public class MarkdownFragmentsValidationTest : TestBase private const string RawModelFileExtension = ".raw.json"; [Fact] - public void OverwriteUneditableTest() + public void OverwriteUnEditableTest() { _outputFolder = GetRandomFolder(); _inputFolder = GetRandomFolder(); diff --git a/test/Microsoft.DocAsCode.Common.Tests/RelativePathTest.cs b/test/Microsoft.DocAsCode.Common.Tests/RelativePathTest.cs index c0f366d0882..8376e7cdd01 100644 --- a/test/Microsoft.DocAsCode.Common.Tests/RelativePathTest.cs +++ b/test/Microsoft.DocAsCode.Common.Tests/RelativePathTest.cs @@ -430,8 +430,8 @@ public void TestUrlDecode(string path, string expected) [InlineData("../../", "../", false)] [InlineData("../", "../../", false)] [InlineData("~/a/b", "~/../", false)] - public void TestStartsWith(string source, string dest, bool isStarstsWith) + public void TestStartsWith(string source, string dest, bool isStartsWith) { - Assert.Equal(isStarstsWith, ((RelativePath)source).InDirectory((RelativePath)dest)); + Assert.Equal(isStartsWith, ((RelativePath)source).InDirectory((RelativePath)dest)); } } diff --git a/test/Microsoft.DocAsCode.Common.Tests/UriTemplateTest.cs b/test/Microsoft.DocAsCode.Common.Tests/UriTemplateTest.cs index ce4fea45ec7..237d481f139 100644 --- a/test/Microsoft.DocAsCode.Common.Tests/UriTemplateTest.cs +++ b/test/Microsoft.DocAsCode.Common.Tests/UriTemplateTest.cs @@ -71,7 +71,7 @@ public void TestUriTemplate_Multipipeline() } [Fact] - public void TestUriTemplate_PipelineInEnviroment() + public void TestUriTemplate_PipelineInEnvironment() { Environment.SetEnvironmentVariable("pipeline", "|>trim|>warpWord < >"); var template = UriTemplate<string>.Parse( diff --git a/test/Microsoft.DocAsCode.Common.Tests/YamlDeserializerWithFallbackTest.cs b/test/Microsoft.DocAsCode.Common.Tests/YamlDeserializerWithFallbackTest.cs index 37ba85bb3f1..6e031def429 100644 --- a/test/Microsoft.DocAsCode.Common.Tests/YamlDeserializerWithFallbackTest.cs +++ b/test/Microsoft.DocAsCode.Common.Tests/YamlDeserializerWithFallbackTest.cs @@ -11,16 +11,16 @@ public class YamlDeserializerWithFallbackTest [Fact] public void TestYamlDeserializerWithFallback() { - var deserialzer = YamlDeserializerWithFallback.Create<string>() + var deserializer = YamlDeserializerWithFallback.Create<string>() .WithFallback<List<string>>(); { - var obj = deserialzer.Deserialize(() => new StringReader(@"A")); + var obj = deserializer.Deserialize(() => new StringReader(@"A")); Assert.NotNull(obj); var a = Assert.IsType<string>(obj); Assert.Equal("A", a); } { - var obj = deserialzer.Deserialize(() => new StringReader(@"- A + var obj = deserializer.Deserialize(() => new StringReader(@"- A - B")); Assert.NotNull(obj); var a = Assert.IsType<List<string>>(obj); @@ -28,7 +28,7 @@ public void TestYamlDeserializerWithFallback() Assert.Equal("B", a[1]); } { - var ex = Assert.Throws<YamlException>(() => deserialzer.Deserialize(() => new StringReader(@"- A + var ex = Assert.Throws<YamlException>(() => deserializer.Deserialize(() => new StringReader(@"- A - A: abc"))); Assert.Equal(2, ex.Start.Line); Assert.Equal(3, ex.Start.Column); @@ -38,23 +38,23 @@ public void TestYamlDeserializerWithFallback() [Fact] public void TestYamlDeserializerWithFallback_MultiFallback() { - var deserialzer = YamlDeserializerWithFallback.Create<int>() + var deserializer = YamlDeserializerWithFallback.Create<int>() .WithFallback<string>() .WithFallback<string[]>(); { - var obj = deserialzer.Deserialize(() => new StringReader(@"1")); + var obj = deserializer.Deserialize(() => new StringReader(@"1")); Assert.NotNull(obj); var a = Assert.IsType<int>(obj); Assert.Equal(1, a); } { - var obj = deserialzer.Deserialize(() => new StringReader(@"A")); + var obj = deserializer.Deserialize(() => new StringReader(@"A")); Assert.NotNull(obj); var a = Assert.IsType<string>(obj); Assert.Equal("A", a); } { - var obj = deserialzer.Deserialize(() => new StringReader(@"- A + var obj = deserializer.Deserialize(() => new StringReader(@"- A - B")); Assert.NotNull(obj); var a = Assert.IsType<string[]>(obj); @@ -62,7 +62,7 @@ public void TestYamlDeserializerWithFallback_MultiFallback() Assert.Equal("B", a[1]); } { - var ex = Assert.Throws<YamlException>(() => deserialzer.Deserialize(() => new StringReader(@"- A + var ex = Assert.Throws<YamlException>(() => deserializer.Deserialize(() => new StringReader(@"- A - A: abc"))); Assert.Equal(2, ex.Start.Line); Assert.Equal(3, ex.Start.Column); diff --git a/test/Microsoft.DocAsCode.Common.Tests/YamlSerializationTest.cs b/test/Microsoft.DocAsCode.Common.Tests/YamlSerializationTest.cs index 4f580472c5c..c8b8f421948 100644 --- a/test/Microsoft.DocAsCode.Common.Tests/YamlSerializationTest.cs +++ b/test/Microsoft.DocAsCode.Common.Tests/YamlSerializationTest.cs @@ -82,7 +82,7 @@ public void TestBasicClass() } [Fact] - public void TestBasicClassWithNullCharactor() + public void TestBasicClassWithNullCharacter() { var sw = new StringWriter(); YamlUtility.Serialize(sw, new BasicClass { B = 1, C = "~" }, YamlMime.YamlMimePrefix + "Test-Yaml-Mime"); diff --git a/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs b/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs index 759de1a2670..6d523950cec 100644 --- a/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs +++ b/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs @@ -161,17 +161,17 @@ public sealed class Class1<T> where T : struct, IEnumerable<T> Assert.Equal("public TResult? Func1<TResult>(T? x, IEnumerable<T> y) where TResult : struct", function.Syntax.Content[SyntaxLanguage.CSharp]); } { - var proptery = output.Items[0].Items[0].Items[1]; - Assert.NotNull(proptery); - Assert.Equal("Items", proptery.DisplayNames.First().Value); - Assert.Equal("Class1<T>.Items", proptery.DisplayNamesWithType.First().Value); - Assert.Equal("Test1.Class1<T>.Items", proptery.DisplayQualifiedNames.First().Value); - Assert.Equal("Test1.Class1`1.Items", proptery.Name); - Assert.Empty(proptery.Syntax.Parameters); - var returnValue = proptery.Syntax.Return; + var property = output.Items[0].Items[0].Items[1]; + Assert.NotNull(property); + Assert.Equal("Items", property.DisplayNames.First().Value); + Assert.Equal("Class1<T>.Items", property.DisplayNamesWithType.First().Value); + Assert.Equal("Test1.Class1<T>.Items", property.DisplayQualifiedNames.First().Value); + Assert.Equal("Test1.Class1`1.Items", property.Name); + Assert.Empty(property.Syntax.Parameters); + var returnValue = property.Syntax.Return; Assert.NotNull(returnValue.Type); Assert.Equal("System.Collections.Generic.IEnumerable{{T}}", returnValue.Type); - Assert.Equal(@"public IEnumerable<T> Items { get; set; }", proptery.Syntax.Content[SyntaxLanguage.CSharp]); + Assert.Equal(@"public IEnumerable<T> Items { get; set; }", property.Syntax.Content[SyntaxLanguage.CSharp]); } { var event1 = output.Items[0].Items[0].Items[2]; @@ -207,17 +207,17 @@ public sealed class Class1<T> where T : struct, IEnumerable<T> Assert.Equal("public static bool operator ==(Class1<T> x, Class1<T> y)", operator1.Syntax.Content[SyntaxLanguage.CSharp]); } { - var proptery = output.Items[0].Items[0].Items[4]; - Assert.NotNull(proptery); - Assert.Equal("Items2", proptery.DisplayNames.First().Value); - Assert.Equal("Class1<T>.Items2", proptery.DisplayNamesWithType.First().Value); - Assert.Equal("Test1.Class1<T>.Items2", proptery.DisplayQualifiedNames.First().Value); - Assert.Equal("Test1.Class1`1.Items2", proptery.Name); - Assert.Empty(proptery.Syntax.Parameters); - var returnValue = proptery.Syntax.Return; + var property = output.Items[0].Items[0].Items[4]; + Assert.NotNull(property); + Assert.Equal("Items2", property.DisplayNames.First().Value); + Assert.Equal("Class1<T>.Items2", property.DisplayNamesWithType.First().Value); + Assert.Equal("Test1.Class1<T>.Items2", property.DisplayQualifiedNames.First().Value); + Assert.Equal("Test1.Class1`1.Items2", property.Name); + Assert.Empty(property.Syntax.Parameters); + var returnValue = property.Syntax.Return; Assert.NotNull(returnValue.Type); Assert.Equal("System.Collections.Generic.IEnumerable{{T}}", returnValue.Type); - Assert.Equal(@"public IEnumerable<T> Items2 { get; }", proptery.Syntax.Content[SyntaxLanguage.CSharp]); + Assert.Equal(@"public IEnumerable<T> Items2 { get; }", property.Syntax.Content[SyntaxLanguage.CSharp]); } // check references { @@ -225,13 +225,13 @@ public sealed class Class1<T> where T : struct, IEnumerable<T> Assert.True(output.References.Count > 0); Assert.True(output.References.ContainsKey("Test1.Class1`1")); - var refenence = output.References["Test1.Class1`1"]; - Assert.True(refenence.IsDefinition); - Assert.Equal("Test1", refenence.Parent); + var reference = output.References["Test1.Class1`1"]; + Assert.True(reference.IsDefinition); + Assert.Equal("Test1", reference.Parent); Assert.True(output.References.ContainsKey("Test1")); - refenence = output.References["Test1"]; - Assert.True(refenence.IsDefinition); - Assert.Null(refenence.Parent); + reference = output.References["Test1"]; + Assert.True(reference.IsDefinition); + Assert.Null(reference.Parent); Assert.True(output.References.ContainsKey("System.Collections.Generic.Dictionary`2")); Assert.NotNull(output.References["System.Collections.Generic.Dictionary`2"]); @@ -311,26 +311,26 @@ public interface IFooBar : IBar { } MetadataItem output = Verify(code); Assert.Single(output.Items); - var ifoo = output.Items[0].Items[0]; - Assert.NotNull(ifoo); - Assert.Equal("IFoo", ifoo.DisplayNames[SyntaxLanguage.CSharp]); - Assert.Equal("IFoo", ifoo.DisplayNamesWithType[SyntaxLanguage.CSharp]); - Assert.Equal("Test1.IFoo", ifoo.DisplayQualifiedNames[SyntaxLanguage.CSharp]); - Assert.Equal("public interface IFoo", ifoo.Syntax.Content[SyntaxLanguage.CSharp]); + var iFoo = output.Items[0].Items[0]; + Assert.NotNull(iFoo); + Assert.Equal("IFoo", iFoo.DisplayNames[SyntaxLanguage.CSharp]); + Assert.Equal("IFoo", iFoo.DisplayNamesWithType[SyntaxLanguage.CSharp]); + Assert.Equal("Test1.IFoo", iFoo.DisplayQualifiedNames[SyntaxLanguage.CSharp]); + Assert.Equal("public interface IFoo", iFoo.Syntax.Content[SyntaxLanguage.CSharp]); - var ibar = output.Items[0].Items[1]; - Assert.NotNull(ibar); - Assert.Equal("IBar", ibar.DisplayNames[SyntaxLanguage.CSharp]); - Assert.Equal("IBar", ibar.DisplayNamesWithType[SyntaxLanguage.CSharp]); - Assert.Equal("Test1.IBar", ibar.DisplayQualifiedNames[SyntaxLanguage.CSharp]); - Assert.Equal("public interface IBar : IFoo", ibar.Syntax.Content[SyntaxLanguage.CSharp]); + var iBar = output.Items[0].Items[1]; + Assert.NotNull(iBar); + Assert.Equal("IBar", iBar.DisplayNames[SyntaxLanguage.CSharp]); + Assert.Equal("IBar", iBar.DisplayNamesWithType[SyntaxLanguage.CSharp]); + Assert.Equal("Test1.IBar", iBar.DisplayQualifiedNames[SyntaxLanguage.CSharp]); + Assert.Equal("public interface IBar : IFoo", iBar.Syntax.Content[SyntaxLanguage.CSharp]); - var ifoobar = output.Items[0].Items[2]; - Assert.NotNull(ifoobar); - Assert.Equal("IFooBar", ifoobar.DisplayNames[SyntaxLanguage.CSharp]); - Assert.Equal("IFooBar", ifoobar.DisplayNamesWithType[SyntaxLanguage.CSharp]); - Assert.Equal("Test1.IFooBar", ifoobar.DisplayQualifiedNames[SyntaxLanguage.CSharp]); - Assert.Equal("public interface IFooBar : IBar, IFoo", ifoobar.Syntax.Content[SyntaxLanguage.CSharp]); + var iFooBar = output.Items[0].Items[2]; + Assert.NotNull(iFooBar); + Assert.Equal("IFooBar", iFooBar.DisplayNames[SyntaxLanguage.CSharp]); + Assert.Equal("IFooBar", iFooBar.DisplayNamesWithType[SyntaxLanguage.CSharp]); + Assert.Equal("Test1.IFooBar", iFooBar.DisplayQualifiedNames[SyntaxLanguage.CSharp]); + Assert.Equal("public interface IFooBar : IBar, IFoo", iFooBar.Syntax.Content[SyntaxLanguage.CSharp]); } [Fact] @@ -444,14 +444,14 @@ public interface IFooBar : IFoo, IBar { } Assert.Equal(new[] { "System.Object", "Test1.Foo{{T}[]}" }, bar.Inheritance); Assert.Equal(new[] { "Test1.IFoo", "Test1.IBar" }, bar.Implements); - var foobar = output.Items[0].Items[2]; - Assert.NotNull(foobar); - Assert.Equal("FooBar", foobar.DisplayNames[SyntaxLanguage.CSharp]); - Assert.Equal("FooBar", foobar.DisplayNamesWithType[SyntaxLanguage.CSharp]); - Assert.Equal("Test1.FooBar", foobar.DisplayQualifiedNames[SyntaxLanguage.CSharp]); - Assert.Equal("public class FooBar : Bar<string>, IFooBar, IFoo, IBar", foobar.Syntax.Content[SyntaxLanguage.CSharp]); - Assert.Equal(new[] { "System.Object", "Test1.Foo{System.String[]}", "Test1.Bar{System.String}" }, foobar.Inheritance); - Assert.Equal(new[] { "Test1.IFoo", "Test1.IBar", "Test1.IFooBar" }.OrderBy(s => s), foobar.Implements.OrderBy(s => s)); + var fooBar = output.Items[0].Items[2]; + Assert.NotNull(fooBar); + Assert.Equal("FooBar", fooBar.DisplayNames[SyntaxLanguage.CSharp]); + Assert.Equal("FooBar", fooBar.DisplayNamesWithType[SyntaxLanguage.CSharp]); + Assert.Equal("Test1.FooBar", fooBar.DisplayQualifiedNames[SyntaxLanguage.CSharp]); + Assert.Equal("public class FooBar : Bar<string>, IFooBar, IFoo, IBar", fooBar.Syntax.Content[SyntaxLanguage.CSharp]); + Assert.Equal(new[] { "System.Object", "Test1.Foo{System.String[]}", "Test1.Bar{System.String}" }, fooBar.Inheritance); + Assert.Equal(new[] { "Test1.IFoo", "Test1.IBar", "Test1.IFooBar" }.OrderBy(s => s), fooBar.Implements.OrderBy(s => s)); Assert.NotNull(output.References); Assert.Equal(19, output.References.Count); @@ -1220,7 +1220,7 @@ public class Foo public static bool operator <(Foo x, int y) => false; public static bool operator >=(Foo x, int y) => false; public static bool operator <=(Foo x, int y) => false; - // convertion + // conversion public static implicit operator Foo (int x) => null; public static explicit operator int (Foo x) => 0; } diff --git a/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromVBUnitTest.cs b/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromVBUnitTest.cs index d0150aea786..3995d46b357 100644 --- a/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromVBUnitTest.cs +++ b/test/Microsoft.DocAsCode.Dotnet.Tests/GenerateMetadataFromVBUnitTest.cs @@ -19,7 +19,7 @@ private static MetadataItem Verify(string code, ExtractMetadataConfig options = [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithClass() + public void TestGenerateMetadataWithClass() { string code = @" Imports System.Collections.Generic @@ -72,7 +72,7 @@ End Namespace } [Fact] - public void TestGenereateMetadataWithEnum() + public void TestGenerateMetadataWithEnum() { string code = @" Namespace Test1 @@ -114,7 +114,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithInterface() + public void TestGenerateMetadataWithInterface() { string code = @" Namespace Test1 @@ -157,7 +157,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithStructure() + public void TestGenerateMetadataWithStructure() { string code = @" Namespace Test1 @@ -279,7 +279,7 @@ End Class [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithDelegate() + public void TestGenerateMetadataWithDelegate() { string code = @" Namespace Test1 @@ -317,7 +317,7 @@ End Namespace } [Fact] - public void TestGenereateMetadataWithModule() + public void TestGenerateMetadataWithModule() { string code = @" Namespace Test1 @@ -340,7 +340,7 @@ End Namespace [Trait("Related", "Generic")] [Trait("Related", "Inheritance")] [Fact] - public void TestGenereateMetadataWithMethod() + public void TestGenerateMetadataWithMethod() { string code = @" Namespace Test1 @@ -496,7 +496,7 @@ End Namespace } [Fact] - public void TestGenereateMetadataWithOperator() + public void TestGenerateMetadataWithOperator() { string code = @" Namespace Test1 @@ -770,7 +770,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithConstructor() + public void TestGenerateMetadataWithConstructor() { string code = @" Namespace Test1 @@ -820,7 +820,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithField() + public void TestGenerateMetadataWithField() { string code = @" Namespace Test1 @@ -908,7 +908,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithEvent() + public void TestGenerateMetadataWithEvent() { string code = @" Imports System @@ -969,7 +969,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithProperty() + public void TestGenerateMetadataWithProperty() { string code = @" Namespace Test1 @@ -1128,7 +1128,7 @@ End Namespace [Trait("Related", "Generic")] [Fact] - public void TestGenereateMetadataWithIndex() + public void TestGenerateMetadataWithIndex() { string code = @" Imports System @@ -1301,7 +1301,7 @@ End Namespace [Trait("Related", "Generic")] [Trait("Related", "Multilanguage")] [Fact] - public void TestGenereateMetadataAsyncWithMultilanguage() + public void TestGenerateMetadataAsyncWithMultilanguage() { string code = @" Namespace Test1 diff --git a/test/Microsoft.DocAsCode.MarkdigEngine.Tests/InclusionTest.cs b/test/Microsoft.DocAsCode.MarkdigEngine.Tests/InclusionTest.cs index 898766641e9..6672cde357b 100644 --- a/test/Microsoft.DocAsCode.MarkdigEngine.Tests/InclusionTest.cs +++ b/test/Microsoft.DocAsCode.MarkdigEngine.Tests/InclusionTest.cs @@ -68,7 +68,7 @@ Test Include File [Fact] [Trait("Related", "IncludeFile")] - public void TestBlockLevelInclusion_Esacape() + public void TestBlockLevelInclusion_Escape() { var root = @" # Hello World @@ -503,11 +503,11 @@ public void TestFallback_InclusionWithCodeFences() // 1. Prepare data var root = @"markdown root.md main content start. -mardown a content in root.md content start +markdown a content in root.md content start [!include[a](a_folder/a.md ""This is a.md"")] -mardown a content in root.md content end +markdown a content in root.md content end sample 1 code in root.md content start @@ -558,13 +558,13 @@ code_in_a in a.md content end var rootMarked = service.Markup("place", "holder"); var rootDependency = rootMarked.Dependency; Assert.Equal(@"<p>markdown root.md main content start.</p> -<p>mardown a content in root.md content start</p> +<p>markdown a content in root.md content start</p> <p>markdown a.md main content start.</p> <p>code_in_a code in a.md content start</p> <pre><code class=""lang-cs"" name=""this is code_in_a code"">namespace code_in_a{} </code></pre><p>code_in_a in a.md content end</p> <p>markdown a.md a.md content end.</p> -<p>mardown a content in root.md content end</p> +<p>markdown a content in root.md content end</p> <p>sample 1 code in root.md content start</p> <pre><code class=""lang-cs"" name=""this is sample 1 code"">namespace sample1{} </code></pre><p>sample 1 code in root.md content end</p> diff --git a/test/docfx.Tests/CompositeCommandTest.cs b/test/docfx.Tests/CompositeCommandTest.cs index 642837f3002..b965e8c21d0 100644 --- a/test/docfx.Tests/CompositeCommandTest.cs +++ b/test/docfx.Tests/CompositeCommandTest.cs @@ -107,9 +107,9 @@ public class HelloWorld {}} var sitemap = Path.Combine(_outputFolder, "site", "sitemap.xml"); Assert.True(File.Exists(sitemap)); - XDocument xdoc = XDocument.Load(sitemap); + XDocument xDoc = XDocument.Load(sitemap); - var documentElement = xdoc.Elements().FirstOrDefault(); + var documentElement = xDoc.Elements().FirstOrDefault(); Assert.NotNull(documentElement); var ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; Assert.Equal(ns, documentElement.GetDefaultNamespace());