mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Formats code comments as sentences in the production sources.
Capitalizes the first word and adds the terminal period across the domain, application, data access, infrastructure, API and web layers and the plugins. No comment is reworded. The change also normalizes the TODO bodies to lowercase, leaves commented-out code untouched, corrects the Threat/Treat typo and the dangling hyphen in the exception middleware, and collapses two accidental repeated terminal periods.
This commit is contained in:
1 parent
88455fec9c
commit
727aa33318
142 files changed
+403
-403
No files matched your search
@@ -53,7 +53,7 @@ internal sealed class CalibreArtworkProvider : IArtworkProvider<BookMetadataLook
|
||||
if (string.IsNullOrWhiteSpace(document.CoverHref))
|
||||
return Task.FromResult<IReadOnlyList<ArtworkDto>>([]);
|
||||
|
||||
// the cover reference must be a bare file name contained in the directory of the book, so that no file outside of it can be accessed
|
||||
// The cover reference must be a bare file name contained in the directory of the book, so that no file outside of it can be accessed.
|
||||
string coverFileName = Path.GetFileName(document.CoverHref);
|
||||
if (coverFileName != document.CoverHref || Path.IsPathRooted(document.CoverHref))
|
||||
return Task.FromResult<IReadOnlyList<ArtworkDto>>([]);
|
||||
|
||||
@@ -34,7 +34,7 @@ internal static class OpfReader
|
||||
try
|
||||
{
|
||||
using FileStream fileStream = File.OpenRead(opfFilePath);
|
||||
// the OPF file is untrusted XML, so DTD processing and external entity resolution are disabled, and the document size is bounded
|
||||
// The OPF file is untrusted XML, so DTD processing and external entity resolution are disabled, and the document size is bounded.
|
||||
XmlReaderSettings xmlReaderSettings = new()
|
||||
{
|
||||
DtdProcessing = DtdProcessing.Prohibit,
|
||||
@@ -48,7 +48,7 @@ internal static class OpfReader
|
||||
}
|
||||
catch (XmlException)
|
||||
{
|
||||
// a malformed OPF file must not prevent the enrichment of the book from proceeding
|
||||
// A malformed OPF file must not prevent the enrichment of the book from proceeding.
|
||||
}
|
||||
|
||||
return document;
|
||||
|
||||
@@ -104,7 +104,7 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider<BookMe
|
||||
OpenLibrarySearchDocumentResponse? openLibrarySearchDocumentResponse = null;
|
||||
string? openLibraryId = bookMetadataLookup.OpenLibraryId;
|
||||
string? isbn = bookMetadataLookup.Isbn;
|
||||
// if we have an Open Library Id, that's the first thing we should search by
|
||||
// If we have an Open Library Id, that's the first thing we should search by.
|
||||
if (!string.IsNullOrWhiteSpace(openLibraryId))
|
||||
{
|
||||
string olid = NormalizeOlid(openLibraryId);
|
||||
@@ -123,10 +123,10 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider<BookMe
|
||||
if (openLibraryEditionResponse is null && openLibraryWorkResponse is null)
|
||||
return null;
|
||||
}
|
||||
// no Open Library Id, let's try by ISBN
|
||||
// No Open Library Id, let's try by ISBN.
|
||||
if (openLibraryEditionResponse is null && !string.IsNullOrWhiteSpace(isbn))
|
||||
openLibraryEditionResponse = await _openLibraryHttpClient.GetEditionByIsbnAsync(isbn, cancellationToken).ConfigureAwait(false);
|
||||
// if we still have no results, let's go nuclear and search by metadata
|
||||
// If we still have no results, let's go nuclear and search by metadata.
|
||||
if (openLibraryEditionResponse is null && openLibraryWorkResponse is null)
|
||||
{
|
||||
IReadOnlyList<OpenLibrarySearchDocumentResponse> searchResults = await _openLibraryHttpClient.SearchAsync(bookMetadataLookup, 1, cancellationToken).ConfigureAwait(false);
|
||||
@@ -143,7 +143,7 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider<BookMe
|
||||
if (openLibraryEditionResponse is null && searchResults[0].EditionKeys.Count > 0)
|
||||
openLibraryEditionResponse = await _openLibraryHttpClient.GetEditionAsync(searchResults[0].EditionKeys[0], cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
// if by this time we still have no result, let's forget it...
|
||||
// If by this time we still have no result, let's forget it...
|
||||
if (openLibraryEditionResponse is null && openLibraryWorkResponse is null && openLibrarySearchDocumentResponse is null)
|
||||
return null;
|
||||
|
||||
@@ -208,7 +208,7 @@ internal sealed class OpenLibraryBookMetadataProvider : IMetadataProvider<BookMe
|
||||
private static int ScoreEdition(OpenLibraryEditionResponse openLibraryEdition, string? wantedIsbn, string? wantedLanguage)
|
||||
{
|
||||
int score = 0;
|
||||
// if we get an ISBN match, that's the most certain identification score
|
||||
// If we get an ISBN match, that's the most certain identification score.
|
||||
if (wantedIsbn is not null && openLibraryEdition.Isbn10.Concat(openLibraryEdition.Isbn13).Any(value => string.Equals(SafeNormalizeIsbn(value), wantedIsbn, StringComparison.OrdinalIgnoreCase)))
|
||||
score += 10_000;
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ internal static class PdfDocumentParser
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// The bookmarks of a malformed PDF are best effort, so the table of contents is skipped instead of failing the book; the pages themselves are still readable
|
||||
// The bookmarks of a malformed PDF are best effort, so the table of contents is skipped instead of failing the book; the pages themselves are still readable.
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user