Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API change with rowID & fieldName added to notices #29

Merged
merged 5 commits into from
Sep 13, 2020
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ All of the following fields may be missing or undefined, i.e., they're all optio
1. `extract`: An extract (if available) of the checked text which indicates the area containing the problem. Where helpful, some character substitutions have already been made, for example, if the notice is about spaces, it is generally helpful to display spaces as a visible character in an attempt to best highlight the issue to the user. (The length of the extract defaults to ten characters, but is settable as an option.)
1. `location`: A string indicating the context of the notice, e.g., "in line 17 of 'someBook.usfm'". (Still not completely sure what should be left in this string now that we have added optional `filename`, `repoName`, `lineNumber` fields.)

Keeping our notices in this format, rather than the simplicity of just saving an array of single strings, allows the above *notice components* to be processed at a higher level, e.g., to allow user-controlled filtering, sorting, etc. The default is to funnel them all through the supplied `processNoticesToErrorsWarnings` function (in core/notice-processing-functions.fs) which does the following:
Keeping our notices in this format, rather than the simplicity of just saving an array of single strings, allows the above *notice components* to be processed at a higher level, e.g., to allow user-controlled filtering, sorting, etc. The default is to funnel them all through the supplied `processNoticesToErrorsWarnings` function (in demos/notice-processing-functions.fs) which does the following:

1. Removes excess repeated errors. For example, if there's a systematic error in a file, say with unneeded leading spaces in every field, rather than returning with hundreds of errors, only the first several errors will be returned, followed by an "errors suppressed" message. (The number of each error displayed is settable as an option -- zero means display all errors with no suppression.)
1. Separates notices into error and warning lists based on the priority number. (The switch-over point is settable as an option.)
Expand Down
25 changes: 12 additions & 13 deletions noticeList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ Got 201 notices:
790, C,V, "Missing verse number", lineNumber:n+1, location:` after ${C}:${lastV}${withString}`}
779, "Missing ID field", location:ourRowLocation}
779, "Missing ID field", location:ourRowLocation}
778, "ID should be exactly 4 characters", location:` (not ${fieldID.length})`}
778, "ID should be exactly 4 characters", location:` (not ${fieldID.length})`}
778, "ID should be exactly 4 characters", location:` (not ${rowID.length})`}
778, "ID should be exactly 4 characters", location:` (not ${rowID.length})`}
769, C, V, "Verse bridge numbers not in ascending order", lineNumber:n, characterIndex:3, extract:`${rest.substring(0, Math.max(9, extractLength))}${rest.length > extractLength ? '…' : ''} (${firstV} → ${secondV})`, location:atString}
765, C, V, "Bridged verse numbers didn't increment correctly", lineNumber:n, characterIndex:3, extract:`${rest.substring(0, Math.max(9, extractLength))}${rest.length > extractLength ? '…' : ''} (${lastV} → ${firstV})`, location:atString}
765, "Unexpected link", characterIndex, extract, location:ourAtString}
Expand Down Expand Up @@ -128,8 +128,8 @@ Got 201 notices:
733, C,V, `Receding '${V}' verse number after '${lastV}'`, lineNumber:n+1, location:withString}
730, C,V, "Missing ID", lineNumber:n+1, location:withString}
730, C,V, "Missing ID", lineNumber:n+1, location:withString}
729, C,V, `Duplicate '${fieldID}' ID`, lineNumber:n+1, location:withString}
729, C,V, `Duplicate '${fieldID}' ID`, lineNumber:n+1, location:withString}
729, C,V, `Duplicate '${rowID}' ID`, lineNumber:n+1, location:withString}
729, C,V, `Duplicate '${rowID}' ID`, lineNumber:n+1, location:withString}
724, C, V, "Unable to convert chapter number to integer", lineNumber:n, characterIndex:3, extract:`${rest.substring(0, halfLength)}${rest.length > halfLength ? '…' : ''}`, location:atString}
723, C, V, "Unable to convert verse number to integer", lineNumber:n, characterIndex:3, extract:`${rest.substring(0, halfLength)}${rest.length > halfLength ? '…' : ''}`, location:atString}
722, "Unable to find original language quote in verse text", extract, location:ourLocation}
Expand Down Expand Up @@ -179,14 +179,14 @@ Got 201 notices:
179, "Unexpected space before ellipse character", characterIndex, extract, location:ourAtString}
178, "Unexpected space after ellipse character", characterIndex, extract, location:ourAtString}
177, `Unexpected doubled ${punctChar} characters`, characterIndex, extract, location:ourAtString}
176, "ID should start with a lowercase letter or digit", characterIndex:0, location:` (not '${fieldID[0]}')`}
176, "ID should start with a lowercase letter or digit", characterIndex:0, location:` (not '${fieldID[0]}')`}
175, "ID should end with a lowercase letter or digit", characterIndex:3, location:` (not '${fieldID[3]}')`}
175, "ID should end with a lowercase letter or digit", characterIndeX:3, location:` (not '${fieldID[3]}')`}
174, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:1, location:` (not '${fieldID[1]}')`}
174, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:1, location:` (not '${fieldID[1]}')`}
173, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:2, location:` (not '${fieldID[2]}')`}
173, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:2, location:` (not '${fieldID[2]}')`}
176, "ID should start with a lowercase letter or digit", characterIndex:0, location:` (not '${rowID[0]}')`}
176, "ID should start with a lowercase letter or digit", characterIndex:0, location:` (not '${rowID[0]}')`}
175, "ID should end with a lowercase letter or digit", characterIndex:3, location:` (not '${rowID[3]}')`}
175, "ID should end with a lowercase letter or digit", characterIndeX:3, location:` (not '${rowID[3]}')`}
174, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:1, location:` (not '${rowID[1]}')`}
174, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:1, location:` (not '${rowID[1]}')`}
173, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:2, location:` (not '${rowID[2]}')`}
173, "ID characters should only be lowercase letters, digits, or hypen", characterIndex:2, location:` (not '${rowID[2]}')`}
172, "Header levels should only increment by one", lineNumber:n, characterIndex:0, location:atString}
163, `Mismatched ${leftChar}${rightChar} characters`, extract:`(left=${lCount.toLocaleString()}, right=${rCount.toLocaleString()})`, location:ourAtString}
159, "Should use proper ellipse character (not periods)", characterIndex, extract, location:ourLocation}
Expand All @@ -201,4 +201,3 @@ Got 201 notices:
103, `USFMGrammar: ${warningString.trim()}`, location}
102, `USFMGrammar: ${warningString}`, location:fileLocation}
101, `USFMGrammar: ${warningString}`, location:ourLocation}

2 changes: 1 addition & 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": "0.8.8",
"version": "0.8.9_alpha1",
"private": false,
"homepage": "https://unfoldingword.github.io/uw-content-validation/",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/BCS-usfm-grammar-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import grammar from 'usfm-grammar';
import * as books from '../core/books/books';


export const USFM_GRAMMAR_VALIDATOR_VERSION = '0.3.1';
// const USFM_GRAMMAR_VALIDATOR_VERSION_STRING = '0.3.1';

const DEFAULT_EXTRACT_LENGTH = 10;

Expand Down
Loading