From 54df2e4452b060f00fe021d9415b8cd8e131dd44 Mon Sep 17 00:00:00 2001 From: "Andrew Petrochuk (from Dev Box)" Date: Sat, 13 Jan 2024 19:34:53 -0800 Subject: [PATCH] Spelling fixes --- src/PAModel/CanvasDocument.cs | 2 +- src/PAModel/Serializers/FileEntry.cs | 2 +- src/PAModel/Serializers/MsAppSerializer.cs | 2 +- src/PAModel/Serializers/SourceSerializer.cs | 30 +++++++++---------- .../ComponentInstanceTransform.cs | 1 - src/PAModel/Themes/Theme.cs | 2 +- src/PAModel/Utility/ControlPath.cs | 4 +-- src/PAModel/Utility/Utilities.cs | 8 ++--- 8 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/PAModel/CanvasDocument.cs b/src/PAModel/CanvasDocument.cs index 6ddd1c0f..eb0d5a55 100644 --- a/src/PAModel/CanvasDocument.cs +++ b/src/PAModel/CanvasDocument.cs @@ -93,7 +93,7 @@ public class CanvasDocument // Tracks duplicate asset file information. When a name collision happens we generate a new name for the duplicate asset file. // This dictionary stores the metadata information for that file - like OriginalName, NewFileName, Path... - // Key is a (case-insesitive) new fileName of the resource. + // Key is a (case-insensitive) new fileName of the resource. // Reason for using FileName of the resource as the key is to avoid name collision across different types eg. Images/close.png, Videos/close.mp4. internal Dictionary _localAssetInfoJson = new(); internal static string AssetFilePathPrefix = @"Assets\"; diff --git a/src/PAModel/Serializers/FileEntry.cs b/src/PAModel/Serializers/FileEntry.cs index c1e5bd05..84dbdd4a 100644 --- a/src/PAModel/Serializers/FileEntry.cs +++ b/src/PAModel/Serializers/FileEntry.cs @@ -29,7 +29,7 @@ internal enum FileKind // If this file is present, it's an older format. OldEntityJSon, - // Resourcs + // Resources PublishInfo, // References diff --git a/src/PAModel/Serializers/MsAppSerializer.cs b/src/PAModel/Serializers/MsAppSerializer.cs index a0f04653..8ee60e85 100644 --- a/src/PAModel/Serializers/MsAppSerializer.cs +++ b/src/PAModel/Serializers/MsAppSerializer.cs @@ -382,7 +382,7 @@ public static CanvasDocument Load(Stream streamToMsapp, ErrorContainer errors) } } - // Only for data-compoents. + // Only for data-components. if (dctemplate?.ComponentTemplates != null) { var order = 0; diff --git a/src/PAModel/Serializers/SourceSerializer.cs b/src/PAModel/Serializers/SourceSerializer.cs index 431dc91b..606d791a 100644 --- a/src/PAModel/Serializers/SourceSerializer.cs +++ b/src/PAModel/Serializers/SourceSerializer.cs @@ -94,7 +94,7 @@ public static CanvasDocument LoadFromSource(string directory2, ErrorContainer er var dir = new DirectoryReader(directory2); var app = new CanvasDocument(); - string appInsightsInstumentationKey = null; + string appInsightsInstrumentationKey = null; // Do the manifest check (and version check) first. // MAnifest lives in top-level directory. @@ -128,7 +128,7 @@ public static CanvasDocument LoadFromSource(string directory2, ErrorContainer er break; case FileKind.AppInsightsKey: var appInsights = file.ToObject(); - appInsightsInstumentationKey = appInsights.InstrumentationKey; + appInsightsInstrumentationKey = appInsights.InstrumentationKey; break; } } @@ -145,9 +145,9 @@ public static CanvasDocument LoadFromSource(string directory2, ErrorContainer er } - if (appInsightsInstumentationKey != null) + if (appInsightsInstrumentationKey != null) { - app._properties.InstrumentationKey = appInsightsInstumentationKey; + app._properties.InstrumentationKey = appInsightsInstrumentationKey; } if (app._header == null) { @@ -206,7 +206,7 @@ public static CanvasDocument LoadFromSource(string directory2, ErrorContainer er app._resourcesJson.Resources = resources.ToArray(); } - // We have processed all the json files in Assets directory, now interate through all the files to add the asset files. + // We have processed all the json files in Assets directory, now iterate through all the files to add the asset files. foreach (var file in dir.EnumerateFiles(AssetsDir)) { // Skip adding the json files which were created to contain the information for duplicate asset files. @@ -230,7 +230,7 @@ public static CanvasDocument LoadFromSource(string directory2, ErrorContainer er app.GetLogoFile(); - // Add the entries for local assets back to resrouces.json + // Add the entries for local assets back to resources.json TransformResourceJson.AddLocalAssetEntriesToResourceJson(app); foreach (var file in dir.EnumerateFiles(OtherDir)) @@ -345,11 +345,11 @@ private static void LoadPcfControlTemplateFiles(ErrorContainer errors, CanvasDoc } } - private static void LoadCustomPagesSchemaMetadata(CanvasDocument app, string custompagesMetadataPath) + private static void LoadCustomPagesSchemaMetadata(CanvasDocument app, string customPagesMetadataPath) { - if (File.Exists(custompagesMetadataPath)) + if (File.Exists(customPagesMetadataPath)) { - var file = new DirectoryReader.Entry(custompagesMetadataPath); + var file = new DirectoryReader.Entry(customPagesMetadataPath); app._customPageInputsMetadata = file.GetContents(); } } @@ -484,7 +484,7 @@ private static void AddControl(CanvasDocument app, string filePath, bool isCompo return; // error condition } - // validate that all the packages refferred are not accidentally deleted from pkgs dierectory + // validate that all the packages referred are not accidentally deleted from pkgs directory ValidateIfTemplateExists(app, controlIR, controlIR, errors); // Since the TestSuites are sharded into individual files make sure to add them as children of AppTest control @@ -622,7 +622,7 @@ public static void SaveAsSource(CanvasDocument app, string directory2, ErrorCont // Loose files. foreach (var file in app._unknownFiles.Values) { - // Standardize the .json files so they're determinsitc and comparable + // Standardize the .json files so they're deterministic and comparable if (file.Name.HasExtension(".json")) { ReadOnlyMemory span = file.RawBytes; @@ -679,7 +679,7 @@ private static void WriteDataSources(DirectoryWriter dir, CanvasDocument app, Er foreach (var kvp in app.GetDataSources()) { // Filename doesn't actually matter, but careful to avoid collisions and overwriting. - // Also be determinstic. + // Also be deterministic. var filename = kvp.Key + ".json"; if (!filenames.Add(filename.ToLower())) @@ -718,7 +718,7 @@ private static void WriteDataSources(DirectoryWriter dir, CanvasDocument app, Er { if (ds.ApiId == "/providers/microsoft.powerapps/apis/shared_commondataservice") { - // This is the old CDS connector, we can't support it since it's optionset format is incompatable with the newer one + // This is the old CDS connector, we can't support it since it's optionset format is incompatible with the newer one errors.UnsupportedError($"Connection {ds.Name} is using the old CDS connector which is incompatible with this tool"); throw new DocumentException(); } @@ -763,7 +763,7 @@ private static void WriteDataSources(DirectoryWriter dir, CanvasDocument app, Er var referenceJson = app._dataSourceReferences[dataSourceDef.DatasetName]; untrackedLdr.Remove(dataSourceDef.DatasetName); - // copy over the localconnectionreference + // copy over the local connection reference if (referenceJson.dataSources?.TryGetValue(dataSourceDef.EntityName, out var dsRef) ?? false) { dataSourceDef.LocalReferenceDSJson = dsRef; @@ -876,7 +876,7 @@ private static void LoadDataSources(CanvasDocument app, DirectoryReader director { // Generate an error, dataset defs have diverged in a way that shouldn't be possible // Each dataset has one instanceurl - errors.ValidationError($"For file {file._relativeName}, the dataset {tableDef.DatasetName} has multiple instanceurls"); + errors.ValidationError($"For file {file._relativeName}, the dataset {tableDef.DatasetName} has multiple instance URLs"); throw new DocumentException(); } diff --git a/src/PAModel/SourceTransforms/ComponentInstanceTransform.cs b/src/PAModel/SourceTransforms/ComponentInstanceTransform.cs index bf748b15..a6213cc2 100644 --- a/src/PAModel/SourceTransforms/ComponentInstanceTransform.cs +++ b/src/PAModel/SourceTransforms/ComponentInstanceTransform.cs @@ -18,7 +18,6 @@ public ComponentInstanceTransform(ErrorContainer errors) _errors = errors; } - public IEnumerable TargetTemplates => ComponentRenames.Keys; public void AfterRead(BlockNode control) diff --git a/src/PAModel/Themes/Theme.cs b/src/PAModel/Themes/Theme.cs index ece79289..5b6575c2 100644 --- a/src/PAModel/Themes/Theme.cs +++ b/src/PAModel/Themes/Theme.cs @@ -12,7 +12,7 @@ namespace Microsoft.PowerPlatform.Formulas.Tools; // Encapsulate the ThemeJson. internal class Theme { - // Outer key is stylename, inner key is property name, inner value is expression + // Outer key is style name, inner key is property name, inner value is expression private readonly Dictionary> _styles = new(StringComparer.OrdinalIgnoreCase); public Theme(ThemesJson themeJson) diff --git a/src/PAModel/Utility/ControlPath.cs b/src/PAModel/Utility/ControlPath.cs index 15c13714..0b7bbd44 100644 --- a/src/PAModel/Utility/ControlPath.cs +++ b/src/PAModel/Utility/ControlPath.cs @@ -30,11 +30,11 @@ public ControlPath Next() public ControlPath Append(string controlName) { - var newpath = new List(_segments) + var newPath = new List(_segments) { controlName }; - return new ControlPath(newpath); + return new ControlPath(newPath); } public ControlPath(List segments) diff --git a/src/PAModel/Utility/Utilities.cs b/src/PAModel/Utility/Utilities.cs index 7bfe105b..f5bd7de2 100644 --- a/src/PAModel/Utility/Utilities.cs +++ b/src/PAModel/Utility/Utilities.cs @@ -152,7 +152,7 @@ public static byte[] ToBytes(this ZipArchiveEntry e) } // JsonElement is loss-less, handles unknown fields without dropping them. - // Convertering to a Poco drops fields we don't recognize. + // Converting to a Poco drops fields we don't recognize. public static JsonElement ToJson(this ZipArchiveEntry e) { using (var s = e.Open()) @@ -198,9 +198,9 @@ public static string GetRelativePath(string relativeTo, string fullPathFile) relativePath = relativePath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); } - // If there was any replacement chracter (black diamond with a white heart) in the original string, it gets encoded to %EF%BF%BD + // If there was any replacement character (black diamond with a white heart) in the original string, it gets encoded to %EF%BF%BD // see details here: http://www.cogsci.ed.ac.uk/~richard/utf-8.cgi?input=%EF%BF%BD&mode=char - // spcial handling to add replacement character back to the original string + // special handling to add replacement character back to the original string relativePath = relativePath.Replace("%EF%BF%BD", "�"); return relativePath; @@ -420,7 +420,7 @@ private static string TruncateName(string name, int length) /// /// djb2 algorithm to compute the hash of a string - /// This must be determinstic and stable since it's used in file names + /// This must be deterministic and stable since it's used in file names /// /// The string for which we need to compute the hash. ///