Skip to content

Commit

Permalink
Merge pull request #216 from unfoldingWord/new.2021.September.4
Browse files Browse the repository at this point in the history
Version 2.2.5
  • Loading branch information
mandolyte authored Sep 28, 2021
2 parents 19ae13c + 0672f4c commit 63703f1
Show file tree
Hide file tree
Showing 53 changed files with 2,384 additions and 2,030 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# Changelog

## [Unreleased](https://github.com/unfoldingWord/uw-content-validation/tree/HEAD)
## [2.2.2](https://github.com/unfoldingWord/uw-content-validation/tree/2.2.2) (2021-09-03)

[Full Changelog](https://github.com/unfoldingWord/uw-content-validation/compare/2.2.0...HEAD)
[Full Changelog](https://github.com/unfoldingWord/uw-content-validation/compare/2.2.1...2.2.2)

**Merged pull requests:**

- Fix bug with repoCode for linked articles; add test for newLine in TN single line field that crashed tC build [\#206](https://github.com/unfoldingWord/uw-content-validation/pull/206) ([RobH123](https://github.com/RobH123))

## [2.2.1](https://github.com/unfoldingWord/uw-content-validation/tree/2.2.1) (2021-09-01)

[Full Changelog](https://github.com/unfoldingWord/uw-content-validation/compare/2.2.0...2.2.1)

**Implemented enhancements:**

- Check strong and x-strong fields in BP check, etc. [\#192](https://github.com/unfoldingWord/uw-content-validation/issues/192)
- Add check for en\_uhal [\#191](https://github.com/unfoldingWord/uw-content-validation/issues/191)
- Add check for en\_ugl [\#190](https://github.com/unfoldingWord/uw-content-validation/issues/190)

**Merged pull requests:**

- Version 2.2.1 [\#205](https://github.com/unfoldingWord/uw-content-validation/pull/205) ([RobH123](https://github.com/RobH123))

## [2.2.0](https://github.com/unfoldingWord/uw-content-validation/tree/2.2.0) (2021-08-12)

[Full Changelog](https://github.com/unfoldingWord/uw-content-validation/compare/2.1.7...2.2.0)
Expand Down
1,075 changes: 539 additions & 536 deletions noticeList.txt

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uw-content-validation",
"description": "Functions for Checking Door43.org Scriptural Content/Resources.",
"version": "2.2.2",
"version": "2.2.5",
"private": false,
"homepage": "https://unfoldingword.github.io/uw-content-validation/",
"repository": {
Expand Down Expand Up @@ -36,6 +36,7 @@
"ajv": "^6.12.6",
"axios": "^0.21.0",
"axios-cache-adapter": "^2.5.0",
"jquery": "^3.6.0",
"js-yaml-parser": "^1.0.0",
"jszip": "^3.5.0",
"localforage": "^1.9.0",
Expand Down
16 changes: 2 additions & 14 deletions src/__tests__/__snapshots__/book-package-check.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "TWL",
"location": " in TWL in en RUT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand Down Expand Up @@ -7016,7 +7015,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "SN",
"location": " in SN in en RUT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -7026,7 +7024,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "SQ",
"location": " in SQ in en RUT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand Down Expand Up @@ -7150,7 +7147,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "TWL",
"location": " in TWL in en TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -7161,7 +7157,7 @@ Object {
},
Object {
"bookID": "TIT",
"details": "username=unfoldingWord error=Simulated error - Could not find src/__tests__/fixtures/unfoldingWord/en_ult/57-TIT.usfm",
"details": "error=Simulated error - Could not find src/__tests__/fixtures/unfoldingWord/en_ult/57-TIT.usfm",
"extra": "LT",
"filename": "57-TIT.usfm",
"location": " in LT in en TIT book package from unfoldingWord master branch",
Expand Down Expand Up @@ -7385,7 +7381,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "SN",
"location": " in SN in en TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -7395,7 +7390,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "SQ",
"location": " in SQ in en TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand Down Expand Up @@ -7481,7 +7475,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "LT",
"location": " in LT in zzz TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -7491,7 +7484,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "ST",
"location": " in ST in zzz TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -7501,7 +7493,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "TN",
"location": " in TN in zzz TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -7511,7 +7502,7 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord, folder=tit/",
"details": "folder=tit/",
"extra": "TQ",
"location": " in unfoldingWord (master)",
"message": "Repository doesn’t exist",
Expand Down Expand Up @@ -7633,7 +7624,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "TWL",
"location": " in TWL in en TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand Down Expand Up @@ -20668,7 +20658,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "SN",
"location": " in SN in en TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand All @@ -20678,7 +20667,6 @@ Object {
"username": "unfoldingWord",
},
Object {
"details": "username=unfoldingWord",
"extra": "SQ",
"location": " in SQ in en TIT book package from unfoldingWord master branch",
"message": "Repository doesn’t exist",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/book-package-check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('checkBookPackage() - ', () => {
checkedRepoNames: rawResults.checkedRepoNames,
};
expect(filteredResults).toMatchSnapshot();
}, 6000); // Allow 6 seconds
}, 8000); // Allow 8 seconds

it('TIT should fail on missing repo', async () => {
const username = 'unfoldingWord';
Expand Down
35 changes: 19 additions & 16 deletions src/core/BCS-usfm-grammar-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,20 @@ export function runBCSGrammarCheck(strictnessString, bookID, fileText, filename,
try { // See if we can improve the result with line and column numbers
// NOTE: The following code is quite fragile
// as it depends on the precise format of the error message returned from USFMParser
const regexResultArray = LINE_COLUMN_NUMBERS_REGEX.exec(parserError);
const [totalLink, lineNumberString, columnNumberString] = regexResultArray;
const regexMatchObject = LINE_COLUMN_NUMBERS_REGEX.exec(parserError);
const [totalLink, lineNumberString, columnNumberString] = regexMatchObject;
ourErrorObject.lineNumber = ourParseInt(lineNumberString);
ourErrorObject.characterIndex = ourParseInt(columnNumberString) - 1;
const errorLineText = fileText.split('\n')[ourErrorObject.lineNumber - 1];
ourErrorObject.excerpt = (ourErrorObject.characterIndex > excerptHalfLength ? '…' : '') + errorLineText.substring(ourErrorObject.characterIndex - excerptHalfLength, ourErrorObject.characterIndex + excerptHalfLengthPlus) + (ourErrorObject.characterIndex + excerptHalfLengthPlus < errorLineText.length ? '…' : '');
// NOTE: Not 100% sure that it’s more helpful to the user if we do this next line ???
ourErrorObject.details = ourErrorObject.details.substring(totalLink.length); // Delete the line and column numbers that we found
ourErrorObject.details = ourErrorObject.details.slice(totalLink.length); // Delete the line and column numbers that we found
} catch (secondError) {
debugLog(`USFMGrammar second error: ${secondError}`);
}
// if (ourErrorObject.excerpt.startsWith('\\va ') || ourErrorObject.excerpt.startsWith('\\ca ')) // lower the priority
if (parserError.indexOf('\\va ') >= 0 || parserError.indexOf('\\ca ') >= 0)
ourErrorObject.priority = 140; // from 840
return { isValidUSFM: false, error: ourErrorObject, warnings: [] };
}
let parserMessages;
Expand All @@ -92,12 +95,12 @@ export function runBCSGrammarCheck(strictnessString, bookID, fileText, filename,
// as it depends on the precise format of the error message returned from USFMParser
let ourErrorObject = {};
if (parseError) {
debugLog("Oh! This USFMGrammer check code IS still needed!!!");
debugLog("Oh! This USFMGrammar check code IS still needed!!!");
const contextRE = /(\d+?)\s\|\s(.+)/g;
for (const errorLine of parseError.split('\n')) {
// debugLog(`BCS errorLine=${errorLine}`);
if (errorLine.startsWith('>')) {
const regexResult = contextRE.exec(errorLine.substring(1).trim());
const regexResult = contextRE.exec(errorLine.slice(1).trim());
// debugLog(` regexResult: ${JSON.stringify(regexResult)}`);
if (regexResult) {
lineNumberString = regexResult[1];
Expand Down Expand Up @@ -156,7 +159,7 @@ export function runBCSGrammarCheck(strictnessString, bookID, fileText, filename,
// debugLog(`warningString: '${warningString}'`);
// Clean up their warnings a little: Remove trailing spaces and periods
let adjustedString = warningString.trim(); // Removes the trailing space
if (adjustedString.endsWith('.')) adjustedString = adjustedString.substring(0, adjustedString.length - 1);
if (adjustedString.endsWith('.')) adjustedString = adjustedString.slice(0, adjustedString.length - 1);
ourWarnings.push(adjustedString);
}

Expand Down Expand Up @@ -199,18 +202,18 @@ export function checkUSFMGrammar(bookID, strictnessString, filename, givenText,
*/
function addNoticePartial(incompleteNoticeObject) {
// functionLog(`checkUSFMGrammar notice: (priority=${priority}) ${message}${characterIndex > 0 ? ` (at character ${characterIndex})` : ""}${excerpt ? ` ${excerpt}` : ""}${location}`);
//parameterAssert(noticeObject.priority !== undefined, "cUSFMgr addNoticePartial: 'priority' parameter should be defined");
//parameterAssert(typeof noticeObject.priority === 'number', `cUSFMgr addNoticePartial: 'priority' parameter should be a number not a '${typeof noticeObject.priority}': ${noticeObject.priority}`);
//parameterAssert(noticeObject.message !== undefined, "cUSFMgr addNoticePartial: 'message' parameter should be defined");
//parameterAssert(typeof noticeObject.message === 'string', `cUSFMgr addNoticePartial: 'message' parameter should be a string not a '${typeof noticeObject.message}': ${noticeObject.message}`);
// //parameterAssert(characterIndex !== undefined, "cUSFMgr addNoticePartial: 'characterIndex' parameter should be defined");
if (incompleteNoticeObject.characterIndex) { //parameterAssert(typeof noticeObject.characterIndex === 'number', `cUSFMgr addNoticePartial: 'characterIndex' parameter should be a number not a '${typeof noticeObject.characterIndex}': ${noticeObject.characterIndex}`);
//parameterAssert(incompleteNoticeObject.priority !== undefined, "cUSFMgr addNoticePartial: 'priority' parameter should be defined");
//parameterAssert(typeof incompleteNoticeObject.priority === 'number', `cUSFMgr addNoticePartial: 'priority' parameter should be a number not a '${typeof incompleteNoticeObject.priority}': ${incompleteNoticeObject.priority}`);
//parameterAssert(incompleteNoticeObject.message !== undefined, "cUSFMgr addNoticePartial: 'message' parameter should be defined");
//parameterAssert(typeof incompleteNoticeObject.message === 'string', `cUSFMgr addNoticePartial: 'message' parameter should be a string not a '${typeof incompleteNoticeObject.message}': ${incompleteNoticeObject.message}`);
// parameterAssert(characterIndex !== undefined, "cUSFMgr addNoticePartial: 'characterIndex' parameter should be defined");
if (incompleteNoticeObject.characterIndex) { parameterAssert(typeof incompleteNoticeObject.characterIndex === 'number', `cUSFMgr addNoticePartial: 'characterIndex' parameter should be a number not a '${typeof incompleteNoticeObject.characterIndex}': ${incompleteNoticeObject.characterIndex}`);
}
// //parameterAssert(excerpt !== undefined, "cUSFMgr addNoticePartial: 'excerpt' parameter should be defined");
if (incompleteNoticeObject.excerpt) { //parameterAssert(typeof noticeObject.excerpt === 'string', `cUSFMgr addNoticePartial: 'excerpt' parameter should be a string not a '${typeof excerpt}': ${noticeObject.excerpt}`);
// parameterAssert(excerpt !== undefined, "cUSFMgr addNoticePartial: 'excerpt' parameter should be defined");
if (incompleteNoticeObject.excerpt) { parameterAssert(typeof incompleteNoticeObject.excerpt === 'string', `cUSFMgr addNoticePartial: 'excerpt' parameter should be a string not a '${typeof excerpt}': ${incompleteNoticeObject.excerpt}`);
}
//parameterAssert(noticeObject.location !== undefined, "cUSFMgr addNoticePartial: 'location' parameter should be defined");
//parameterAssert(typeof noticeObject.location === 'string', `cUSFMgr addNoticePartial: 'location' parameter should be a string not a '${typeof noticeObject.location}': ${noticeObject.location}`);
//parameterAssert(incompleteNoticeObject.location !== undefined, "cUSFMgr addNoticePartial: 'location' parameter should be defined");
//parameterAssert(typeof incompleteNoticeObject.location === 'string', `cUSFMgr addNoticePartial: 'location' parameter should be a string not a '${typeof incompleteNoticeObject.location}': ${incompleteNoticeObject.location}`);
cugResult.noticeList.push({ ...incompleteNoticeObject, bookID, filename });
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/books/books.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const usfmNumberName = (bookId) => {
}

export const expectedVersesPerChapterList = (bookId) => {
// //parameterAssert(bookId.toUpperCase() !== 'OBS', `expectedVersesPerChapterList shouldn’t be passed '${bookId}'`);
// parameterAssert(bookId.toUpperCase() !== 'OBS', `expectedVersesPerChapterList shouldn’t be passed '${bookId}'`);
let verseList;
try {
verseList = BibleBookData[bookId.toUpperCase()].verseList;
Expand All @@ -144,7 +144,7 @@ export const isOneChapterBook = (bookId) => {
};

export const versesInChapter = (bookId, chapter) => {
// //parameterAssert(bookId.toUpperCase() !== 'OBS', `versesInChapter shouldn’t be passed '${bookId}'`);
// parameterAssert(bookId.toUpperCase() !== 'OBS', `versesInChapter shouldn’t be passed '${bookId}'`);
const verses = expectedVersesPerChapterList(bookId)[chapter - 1];
if (verses === undefined) {
throw new Error(`versesInChapter(${bookId}) given invalid chapter: ${chapter}`);
Expand Down
9 changes: 9 additions & 0 deletions src/core/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ export const REPO_CODES_LIST = [
'OBS-TN', 'OBS-TN2', 'OBS-TQ', 'OBS-TQ2',
'OBS-SN', 'OBS-SN2', 'OBS-SQ', 'OBS-SQ2',
];

export const CATALOG_NEXT_ONLY_REPO_CODES_LIST = [
'TWL',
'TN2', 'TQ2',
'SN', 'SQ',
'OBS-TWL',
'OBS-TN2', 'OBS-TQ2',
'OBS-SN2', 'OBS-SQ2',
];
20 changes: 10 additions & 10 deletions src/core/field-link-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export async function startLiveLinksCheck(linksList, existingNoticeList, callbac
//parameterAssert(typeof priority === 'number', `sLLC addNoticePartial: 'priority' parameter should be a number not a '${typeof priority}': ${priority}`);
//parameterAssert(message !== undefined, "sLLC addNoticePartial: 'message' parameter should be defined");
//parameterAssert(typeof message === 'string', `sLLC addNoticePartial: 'message' parameter should be a string not a '${typeof message}':${message}`);
// //parameterAssert(characterIndex!==undefined, "sLLC addNoticePartial: 'characterIndex' parameter should be defined");
if (characterIndex) { //parameterAssert(typeof characterIndex === 'number', `sLLC addNoticePartial: 'characterIndex' parameter should be a number not a '${typeof characterIndex}': ${characterIndex}`);
// parameterAssert(characterIndex!==undefined, "sLLC addNoticePartial: 'characterIndex' parameter should be defined");
if (characterIndex) { parameterAssert(typeof characterIndex === 'number', `sLLC addNoticePartial: 'characterIndex' parameter should be a number not a '${typeof characterIndex}': ${characterIndex}`);
}
// //parameterAssert(excerpt!==undefined, "sLLC addNoticePartial: 'excerpt' parameter should be defined");
if (excerpt) { //parameterAssert(typeof excerpt === 'string', `sLLC addNoticePartial: 'excerpt' parameter should be a string not a '${typeof excerpt}': ${excerpt}`);
// parameterAssert(excerpt!==undefined, "sLLC addNoticePartial: 'excerpt' parameter should be defined");
if (excerpt) { parameterAssert(typeof excerpt === 'string', `sLLC addNoticePartial: 'excerpt' parameter should be a string not a '${typeof excerpt}': ${excerpt}`);
}
// //parameterAssert(location!==undefined, "sLLC addNoticePartial: 'location' parameter should be defined");
// //parameterAssert(typeof location==='string', `sLLC addNoticePartial: 'location' parameter should be a string not a '${typeof location}': ${location}`);
// parameterAssert(location!==undefined, "sLLC addNoticePartial: 'location' parameter should be defined");
// parameterAssert(typeof location==='string', `sLLC addNoticePartial: 'location' parameter should be a string not a '${typeof location}': ${location}`);
result.noticeList.push({ priority, message, characterIndex, excerpt, location });
}

Expand Down Expand Up @@ -106,11 +106,11 @@ export function checkFieldLinks(languageCode, repoCode, fieldName, fieldText, li
//parameterAssert(typeof priority === 'number', `cFLs addNoticePartial: 'priority' parameter should be a number not a '${typeof priority}': ${priority}`);
//parameterAssert(message !== undefined, "cFLs addNoticePartial: 'message' parameter should be defined");
//parameterAssert(typeof message === 'string', `cFLs addNoticePartial: 'message' parameter should be a string not a '${typeof message}': ${message}`);
// //parameterAssert(characterIndex!==undefined, "cFLs addNoticePartial: 'characterIndex' parameter should be defined");
if (characterIndex) { //parameterAssert(typeof characterIndex === 'number', `cFLs addNoticePartial: 'characterIndex' parameter should be a number not a '${typeof characterIndex}': ${characterIndex}`);
// parameterAssert(characterIndex!==undefined, "cFLs addNoticePartial: 'characterIndex' parameter should be defined");
if (characterIndex) { parameterAssert(typeof characterIndex === 'number', `cFLs addNoticePartial: 'characterIndex' parameter should be a number not a '${typeof characterIndex}': ${characterIndex}`);
}
// //parameterAssert(excerpt!==undefined, "cFLs addNoticePartial: 'excerpt' parameter should be defined");
if (excerpt) { //parameterAssert(typeof excerpt === 'string', `cFLs addNoticePartial: 'excerpt' parameter should be a string not a '${typeof excerpt}': ${excerpt}`);
// parameterAssert(excerpt!==undefined, "cFLs addNoticePartial: 'excerpt' parameter should be defined");
if (excerpt) { parameterAssert(typeof excerpt === 'string', `cFLs addNoticePartial: 'excerpt' parameter should be a string not a '${typeof excerpt}': ${excerpt}`);
}
//parameterAssert(location !== undefined, "cFLs addNoticePartial: 'location' parameter should be defined");
//parameterAssert(typeof location === 'string', `cFLs addNoticePartial: 'location' parameter should be a string not a '${typeof location}': ${location}`);
Expand Down
Loading

0 comments on commit 63703f1

Please sign in to comment.