Skip to content

Commit

Permalink
Fix whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
filzrev committed Jun 30, 2023
1 parent b03e06e commit f1dfc9d
Show file tree
Hide file tree
Showing 138 changed files with 193 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private FileModel GenerateNewFileModel(FileModel model, RestApiRootItemViewModel
{
LocalPathFromRoot = model.LocalPathFromRoot,
Uids = CalculateUids(tagModel).Select(i => new UidDefinition(i, model.LocalPathFromRoot)).ToImmutableArray()
};
};

return newModel;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/Config/ContentPairingInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ internal class ContentPairingInfo

[JsonProperty("overwriteFragmentsFolder")]
public string OverwriteFragmentsFolder { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
writer.WriteStartArray();
foreach(var item in (ListWithStringFallback)value)
foreach (var item in (ListWithStringFallback)value)
{
serializer.Serialize(writer, item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ internal class WkhtmltopdfJsonConfig
/// </summary>
[JsonProperty("additionalArguments")]
public string AdditionalArguments { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/Docset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static Task Build(string configPath)
{
return Build(configPath, new());
}

/// <summary>
/// Builds a docset specified by docfx.json config.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/RunBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static string Exec(BuildJsonConfig config, BuildOptions options, string c
// TODO: remove BaseDirectory from Config, it may cause potential issue when abused
var baseDirectory = EnvironmentContext.BaseDirectory;
var outputFolder = Path.GetFullPath(Path.Combine(
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
config.Destination ?? ""));

try
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.App/RunPdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static void Exec(PdfJsonConfig config, BuildOptions buildOptions, string
}

var outputFolder = Path.GetFullPath(Path.Combine(
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
string.IsNullOrEmpty(outputDirectory) ? Path.Combine(baseDirectory, config.Output ?? "") : outputDirectory,
config.Destination ?? ""));

var rawOutputFolder = string.IsNullOrEmpty(config.RawOutputFolder) ? Path.Combine(outputFolder, "_raw") : config.RawOutputFolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Microsoft.DocAsCode.Build.Common;

public abstract class BaseModelAttributeHandler<T> : IModelAttributeHandler where T: Attribute
public abstract class BaseModelAttributeHandler<T> : IModelAttributeHandler where T : Attribute
{
private const int MaximumNestedLevel = 32;
private readonly TypeInfo _typeInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override void Build(FileModel model, IHostService host)
return;
}
var metadata = ((Dictionary<string, object>)model.Content).ToImmutableDictionary().Remove(ConceptualKey);
if(!model.Properties.IsUserDefinedTitle)
if (!model.Properties.IsUserDefinedTitle)
{
metadata = metadata.Remove(Constants.PropertyName.Title);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.DocAsCode.Build.Engine/DocumentBuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed class DocumentBuildContext : IDocumentBuildContext

public DocumentBuildContext(string buildOutputFolder)
: this(buildOutputFolder, Enumerable.Empty<FileAndType>(), ImmutableArray<string>.Empty, ImmutableArray<string>.Empty, 1, Directory.GetCurrentDirectory(), string.Empty, null, null) { }

public DocumentBuildContext(string buildOutputFolder, IEnumerable<FileAndType> allSourceFiles, ImmutableArray<string> externalReferencePackages, ImmutableArray<string> xrefMaps, int maxParallelism, string baseFolder, string versionName, ApplyTemplateSettings applyTemplateSetting, string rootTocPath)
: this(buildOutputFolder, allSourceFiles, externalReferencePackages, xrefMaps, maxParallelism, baseFolder, versionName, applyTemplateSetting, rootTocPath, null) { }

Expand Down Expand Up @@ -287,11 +287,11 @@ private List<XRefMap> LoadXRefMaps()
{
Logger.LogInfo($"Downloading xref maps from:{Environment.NewLine}{string.Join(Environment.NewLine, _xrefMapUrls)}");
var mapTasks = (from url in _xrefMapUrls
select LoadXRefMap(url, _client)).ToArray();
select LoadXRefMap(url, _client)).ToArray();
Task.WaitAll(mapTasks);
return (from t in mapTasks
where t.Result != null
select t.Result).ToList();
where t.Result != null
select t.Result).ToList();
}

private async Task<XRefMap> LoadXRefMap(string url, HttpClient client)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public override int GetHashCode()
{
return Title.GetHashCode() ^ Href.GetHashCode() ^ Keywords.GetHashCode();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override Stream GetResourceStream(string name)
{
for (var i = _readers.Length - 1; i >= 0; i--)
{
if (_readers[i].GetResourceStream(name) is {} result)
if (_readers[i].GetResourceStream(name) is { } result)
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public virtual string GetResource(string name)

public IEnumerable<ResourceInfo> GetResources(string selector = null)
{
foreach(var pair in GetResourceStreams(selector))
foreach (var pair in GetResourceStreams(selector))
{
using (pair.Value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private sealed class FileInfo

public string FilePath { get; set; }

public RelativePath RelativePath{ get; set; }
public RelativePath RelativePath { get; set; }

public FileInfo(string key, string filePath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static JsValue ConvertObjectToJsValue(Jint.Engine engine, object raw)
}
else if (raw is IList<object> list)
{
var jsArray = new JsArray(engine, (uint) list.Count);
var jsArray = new JsArray(engine, (uint)list.Count);
foreach (var item in list)
{
jsArray.Push(ConvertObjectToJsValue(engine, item));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private Jint.Engine CreateEngine(Jint.Engine engine, params string[] sharedVaria
var newEngine = CreateDefaultEngine();
if (sharedVariables != null)
{
foreach(var sharedVariable in sharedVariables)
foreach (var sharedVariable in sharedVariables)
{
newEngine.SetValue(sharedVariable, engine.GetValue(sharedVariable));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public string GetHrefFromRoot(string originalHref, string sourceFileKey)
var file = path.GetPathFromWorkingFolder().UrlDecode();
if (!_context.AllSourceFiles.ContainsKey(file))
{
Logger.LogWarning($"Invalid file link: ({originalHref})", file:sourceFileKey, code:WarningCodes.Build.InvalidFileLink);
Logger.LogWarning($"Invalid file link: ({originalHref})", file: sourceFileKey, code: WarningCodes.Build.InvalidFileLink);
return originalHref;
}
return file.UrlEncode().ToString() + UriUtility.GetQueryStringAndFragment(originalHref);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ public TemplatePageLoader(IResourceFileReader reader, DocumentBuildContext conte

public IEnumerable<Template> LoadAll()
{
foreach(var render in _rendererLoader.LoadAll())
foreach (var render in _rendererLoader.LoadAll())
{
var preprocessors = _preprocessorLoader.LoadFromRenderer(render).ToList();
if (preprocessors.Count > 1)
{
Logger.Log(
LogLevel.Warning,
LogLevel.Warning,
$"Multiple template preprocessors '{preprocessors.Select(s => s.Path).ToDelimitedString()}'(case insensitive) are found for template page '{preprocessors[0].Name}', '{preprocessors[0].Path}' is used and others are ignored.");
}

yield return new Template(render, preprocessors.FirstOrDefault());
}

foreach(var p in _preprocessorLoader.LoadStandalones())
foreach (var p in _preprocessorLoader.LoadStandalones())
{
yield return new Template(null, p);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,5 @@ public static string GetXref(string uid, string text = null)
}

public static string GetHref(string url, string altText = null) =>
$@"<span><a href=""{url}"">{
HttpUtility.HtmlEncode(altText ?? string.Empty)
}</a></span>";
$@"<span><a href=""{url}"">{HttpUtility.HtmlEncode(altText ?? string.Empty)}</a></span>";
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public class ApiLanguageValuePair
[YamlMember(Alias = "value")]
[JsonProperty("value")]
public string Value { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ public static ApiNames FromUid(string uid)
Uid = uid,
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ internal Dictionary<string, object> ConvertContents(Dictionary<object, object> c
AppendNewObject(OPathSegments, content.PropertyNameSource, CreateDocument(content), currentMetadata);
}

return currentMetadata.ToDictionary(k => k.Key.ToString(), k=> k.Value);
return currentMetadata.ToDictionary(k => k.Key.ToString(), k => k.Value);
}

private void AppendNewObject(List<OPathSegment> OPathSegments, Block codeHeaderBlock, MarkdownDocument propertyValue, Dictionary<object, object> contentsMetadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.DocAsCode.Build.OverwriteDocuments;

public interface IOverwriteBlockRule
{
string TokenName{ get; }
string TokenName { get; }

bool Parse(Block block, out string value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.DocAsCode.Build.OverwriteDocuments;

public sealed class L1InlineCodeHeadingRule :InlineCodeHeadingRule
public sealed class L1InlineCodeHeadingRule : InlineCodeHeadingRule
{
public override string TokenName => "L1InlineCodeHeading";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.DocAsCode.Build.OverwriteDocuments;

public sealed class L2InlineCodeHeadingRule :InlineCodeHeadingRule
public sealed class L2InlineCodeHeadingRule : InlineCodeHeadingRule
{
public override string TokenName => "L2InlineCodeHeading";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SwaggerModel
[YamlMember(Alias = "basePath")]
[JsonProperty("basePath")]
public string BasePath { get; set; }

/// <summary>
/// Required. The available paths and operations for the API.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void BuildCore(FileModel model, IHostService host)
if (uidDefinitions.Count == 0)
{
Logger.LogWarning(
$"Unable to find UidDefinition for Uid: { overwriteDocumentModel.Uid}",
$"Unable to find UidDefinition for Uid: {overwriteDocumentModel.Uid}",
code: WarningCodes.Overwrite.InvalidMarkdownFragments);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public BaseSchema FindSchema(DocumentSchema rootSchema)
}

BaseSchema schema = rootSchema;
foreach(var part in _parts)
foreach (var part in _parts)
{
schema = GetChildSchema(schema, part);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public object Interpret(BaseSchema schema, object value, IProcessContext context
}
var val = value;

foreach(var tag in schema.Tags)
foreach (var tag in schema.Tags)
{
foreach (var i in _tagInterpreters.Where(t => t.Matches(tag)).OrderBy(t => t.Order))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public class ApiLanguageValuePair<T>
[YamlMember(Alias = "value")]
[JsonProperty("value")]
public T Value { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public class ApiLanguageValuePairWithLevel<T> : ApiLanguageValuePair<T>
[YamlMember(Alias = "level")]
[JsonProperty("level")]
public int Level { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public class ApiNames
[ExtensibleMember]
[JsonExtensionData]
public Dictionary<string, object> Metadata { get; set; } = new Dictionary<string, object>();
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/CollectionUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void Merge<T>(this Dictionary<string, List<T>> left, IEnumerable<K
}

public static ImmutableDictionary<string, ImmutableList<T>> Merge<T, TRight>(this ImmutableDictionary<string, ImmutableList<T>> left, IEnumerable<KeyValuePair<string, TRight>> right)
where TRight: IEnumerable<T>
where TRight : IEnumerable<T>
{
if (right == null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/ConsoleUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void Write(string message, ConsoleColor color)

public static void WriteLine(string message, ConsoleColor color)
{

try
{
if (color == ConsoleColor.White)
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/ConvertToObjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static object ConvertExpandoObjectToObjectCore(object obj, Dictionary<ob
if (obj is ExpandoObject eo)
{
result = cache[obj] = new Dictionary<string, object>();
foreach(var pair in eo)
foreach (var pair in eo)
{
((Dictionary<string, object>)result)[pair.Key] = ConvertExpandoObjectToObjectCore(pair.Value, cache);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ public bool TestKey(object source, object overrides, IMergeContext context)
});
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/FileLinkInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public struct FileLinkInfo

public bool IsResolved => ToFileInDest != null;

public GroupInfo GroupInfo { get;set; }
public GroupInfo GroupInfo { get; set; }

public static FileLinkInfo Create(string fromFileInSource, string fromFileInDest, string href, IDocumentBuildContext context)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/Git/GitDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ public override string ToString()
{
return $"branch: {RemoteBranch}, url: {RemoteRepositoryUrl}, file: {RelativePath}";
}
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.DocAsCode.Common/Git/GitException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.DocAsCode.Common.Git;

public class GitException : Exception
{
public GitException(string message):base(message)
public GitException(string message) : base(message)
{
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/Git/GitRepoInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public class GitRepoInfo
public string RemoteHeadCommitId { get; set; }

public string LocalHeadCommitId { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/Git/RepoType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public enum RepoType
Unknown,
GitHub,
Vso
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
foreach (var item in ((Dictionary<string, object>)value))
{
writer.WritePropertyName(item.Key);
serializer.Serialize(writer, item.Value);
serializer.Serialize(writer, item.Value);
}
writer.WriteEndObject();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.DocAsCode.Common/Loggers/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static void PrintSummary()
}

ConsoleUtility.WriteLine($" {_warningCount} warning(s)", _warningCount > 0 ? ConsoleColor.Yellow : ConsoleColor.White);
ConsoleUtility.WriteLine($" { _errorCount} error(s)\n", _errorCount > 0 ? ConsoleColor.Red : ConsoleColor.White);
ConsoleUtility.WriteLine($" {_errorCount} error(s)\n", _errorCount > 0 ? ConsoleColor.Red : ConsoleColor.White);
}

[Serializable]
Expand Down
Loading

0 comments on commit f1dfc9d

Please sign in to comment.