Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ private IEnumerable<DocfxContent> GetDocfxContents()
throw new InvalidOperationException("An object array 'contents' was expected to exist under 'build' in 'docfx.json'.");
}

// TODO: repo name, or do the hard work of reading open publishing build config file, determining **ALL** `docfx.json`, and read them.
// TODO: repo name, or do the hard work of reading open publishing build
// config file, determining **ALL** `docfx.json` files, and reading them.
return Build.Contents.Where(content => content.Source is null or "." or "docs");
}

Expand All @@ -34,7 +35,7 @@ public IEnumerable<Matcher> GetMatchers(string? configDirectory = null)
{
var matcher = new Matcher(StringComparison.OrdinalIgnoreCase);

// Adjust the source path based on where docfx.json was found
// Adjust the source path based on where docfx.json was found.
string effectiveSource = GetEffectiveSource(content.Source, configDirectory);

if (content.Files is not null)
Expand All @@ -53,7 +54,7 @@ public IEnumerable<Matcher> GetMatchers(string? configDirectory = null)
{
foreach (string excludePattern in content.Excludes)
{
matcher.AddExclude(excludePattern);
matcher.AddExclude($"{effectiveSource}/{excludePattern}");
}
Comment thread
gewarren marked this conversation as resolved.
}

Expand All @@ -68,20 +69,20 @@ public IEnumerable<Matcher> GetMatchers(string? configDirectory = null)

private static string GetEffectiveSource(string? source, string? configDirectory)
{
// If no config directory (docfx.json at root), use source as-is
// If no config directory (docfx.json at root), use source as-is.
if (string.IsNullOrEmpty(configDirectory))
{
return source ?? ".";
}

// If source is "." or null, it means the content is relative to where docfx.json is
// So we need to prepend the config directory
// If source is "." or null, it means the content is relative to where docfx.json is.
// So we need to prepend the config directory.
if (source is null or ".")
{
return configDirectory;
}

// Otherwise, combine config directory with the specified source
// Otherwise, combine config directory with the specified source.
return $"{configDirectory}/{source}";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public static class RedirectionHelpers
public static async Task<ImmutableArray<string>> GetRedirectionFileNames()
{
// If no redirection files are found in the OPS config, just use the default name.
ImmutableArray<string>? redirectionFileNames = await GetRedirectionFilesAsync() ??
ImmutableArray<string> redirectionFileNames = await GetRedirectionFilesAsync() ??
[".openpublishing.redirection.json"];
Console.WriteLine($"The following {redirectionFileNames.Value.Length} redirection files are registered:");
Console.WriteLine($"The following {redirectionFileNames.Length} redirection files are registered:");
foreach (string filename in redirectionFileNames)
{
Console.WriteLine(filename);
}

return redirectionFileNames.Value;
return redirectionFileNames;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="10.0.11" />
<PackageReference Include="Octokit" Version="14.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BuildVerifier.IO.Abstractions\BuildVerifier.IO.Abstractions.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
public static class RedirectionsVerifier
{
/// <summary>
/// Verifies a redirection for the given source path,
/// and write logs (using GitHub-specific syntax) to a text writer.
/// Verifies a redirection for the given source path
/// and writes logs (using GitHub-specific syntax) to a text writer.
/// </summary>
/// <returns><see langword="true"/> for a valid redirection; <see langword="false"/> otherwise.</returns>
public static async Task<bool> WriteResultsAsync(
Expand Down Expand Up @@ -34,7 +34,7 @@ public static async Task<bool> WriteResultsAsync(
}

// TODO: Verify file existence if it starts with "/<our_docset>".
// Will this require setting the docset as an env variable?.
// Will this require setting the docset as an env variable?
return true;
}
}
Loading