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

Start on suggestions; allow disabling of known issues #59

Merged
merged 25 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
28cd0e9
Remove book code for manifest checks in demo
RobH123 Oct 26, 2020
d6e4193
Fix JSDoc comments
RobH123 Oct 26, 2020
e653d39
Suppress some faulty markdown warnings
RobH123 Oct 27, 2020
524301e
Update
RobH123 Oct 27, 2020
4ca24dd
Extract out DEFAULT_EXTRACT_LENGTH; update punctuation pairs
RobH123 Oct 27, 2020
1e21864
Field text-check returning suggestion
RobH123 Oct 27, 2020
57d6343
Merge branch 'master' into RJHimprovements
RobH123 Oct 27, 2020
4619cfb
Start playing with msgID; remove a few false alarms
RobH123 Oct 28, 2020
3385e97
Finetune notices for 1Ti BP
RobH123 Oct 30, 2020
ae8e3b3
Fix mismatched pair bug
RobH123 Nov 1, 2020
d0f65fd
Add line number links to demos; fix YAML line numbers
RobH123 Nov 1, 2020
2bd6d66
Mechanism to allow disabling of known/allowed issues in repos
RobH123 Nov 2, 2020
d26914e
Check repo existence if files not loading
RobH123 Nov 2, 2020
b28ca5b
Add forgotten file
RobH123 Nov 2, 2020
73dc428
Got 1Ti BP notices to zero
RobH123 Nov 3, 2020
a374153
Improved checking of links within TN; more tests passing
RobH123 Nov 4, 2020
1c23dc2
Improve OccurrenceNote link checking; don't suppress only one message…
RobH123 Nov 4, 2020
aca0e21
Better link checking; more fine-tuning; tests now passing
RobH123 Nov 6, 2020
3cd456e
More disabled errors
RobH123 Nov 6, 2020
a56032a
Add username to TQ notices
RobH123 Nov 6, 2020
6f23344
Fine-tune EST notices; increase extract length
RobH123 Nov 6, 2020
cb03a90
Update snapshots
RobH123 Nov 6, 2020
12a00e6
Default demos to wait
RobH123 Nov 6, 2020
5fe96ab
Suggestions starting to come thru for TSV rows
RobH123 Nov 9, 2020
b600d85
Check trailing spaces before line-break
RobH123 Nov 9, 2020
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
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ All of the following fields may be missing or undefined, i.e., they're all optio

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. 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 optionzero 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.)
1. Optionally drops the lowest priority notices and/or certain given notice types (by priority number).

Expand All @@ -88,14 +88,14 @@ However, the user is, of course, free to create their own alternative version of

There is provision for checking to be altered and/or sped-up when the calling app sets some or all of the following fields in `optionalCheckingOptions`:

- extractLength: an integer which defines how long excerpts of lines containing errors should be -- the default is 10 characters -- the package attempts to place the error in the middle of the extract
- getFile: a function which takes the four parameters ({username, repository, path, branch}) and returns the full text of the relevant Door43 file -- default is to use our own function and associated caching
- fetchRepositoryZipFile: a function which takes the three parameters ({username, repository, branch}) and returns the contents of the zip file containing all the Door43 files -- default is to use our own function and associated caching
- getFileListFromZip: takes the same three parameters and returns a list/array containing the filepaths of all the files in the zip file from Door43 -- default is to use our own function and associated caching
- originalLanguageVerseText: the Hebrew/Aramaic or Greek original language text for the book/chapter/verse of the TSV line being checked -- this enables `OrigQuote` fields to be checked without needing to load and parse the actual USFM file
- extractLength: an integer which defines how long excerpts of lines containing errors should bethe default is 15 charactersthe package attempts to place the error in the middle of the extract
- getFile: a function which takes the four parameters ({username, repository, path, branch}) and returns the full text of the relevant Door43 filedefault is to use our own function and associated caching
- fetchRepositoryZipFile: a function which takes the three parameters ({username, repository, branch}) and returns the contents of the zip file containing all the Door43 filesdefault is to use our own function and associated caching
- getFileListFromZip: takes the same three parameters and returns a list/array containing the filepaths of all the files in the zip file from Door43default is to use our own function and associated caching
- originalLanguageVerseText: the Hebrew/Aramaic or Greek original language text for the book/chapter/verse of the TSV line being checkedthis enables `OrigQuote` fields to be checked without needing to load and parse the actual USFM file
- originalLanguageRepoUsername and originalLanguageRepoBranch: these two fields can be used to specify the username/organisation and/or the branch/tag name for fetching the UHB and UGNT files for checking
- taRepoUsername, taRepoBranchName: these two fields can be used to specify the username/organisation and/or the branch/tag name for fetching the TA files for checking
- taRepoLanguageCode, and taRepoSectionName: can be used to specify how the `SupportReference` field is checked in TA -- defaults are 'en' and 'translate'
- taRepoLanguageCode, and taRepoSectionName: can be used to specify how the `SupportReference` field is checked in TAdefaults are 'en' and 'translate'
- twRepoUsername, twRepoBranchName: these two fields can be used to specify the username/organisation and/or the branch/tag name for fetching the TW files for checking

Most of the high-level demonstrations allow a choice of one of three display formats for notices:
Expand All @@ -107,23 +107,21 @@ Most of the high-level demonstrations allow a choice of one of three display for
In addition, there are some options in the display of notices for the demonstrations, set in `optionalProcessingOptions` used by the sample notice processing functions:

- ignorePriorityNumberList: a list (array) of integers that causes of notices with these priority values to be dropped during notice processing
- sortBy: a string which can be set to 'ByPriority' -- the default is 'AsFound', i.e., unsorted
- errorPriorityLevel: an integer which can define *errors* (vs *warnings*) (if relevant) -- defaults to 700 (and above)
- severePriorityLevel: an integer which can define *severe* errors (if relevant) -- defaults to 800 (and above)
- mediumPriorityLevel: an integer which can define *medium* errors (if relevant) -- defaults to 600 (and up to `severePriorityLevel`)
- cutoffPriorityLevel: an integer which can define notices to be dropped/ignored -- defaults to 0 so none are dropped
- maximumSimilarMessages: an integer which defines how many of a certain notice to display, before summarising and saying something like *99 similar errors suppressed* -- zero means don't ever summarise notices -- defaults to 3
- sortBy: a string which can be set to 'ByPriority'the default is 'AsFound', i.e., unsorted
- errorPriorityLevel: an integer which can define *errors* (vs *warnings*) (if relevant)defaults to 700 (and above)
- severePriorityLevel: an integer which can define *severe* errors (if relevant)defaults to 800 (and above)
- mediumPriorityLevel: an integer which can define *medium* errors (if relevant)defaults to 600 (and up to `severePriorityLevel`)
- cutoffPriorityLevel: an integer which can define notices to be dropped/ignoreddefaults to 0 so none are dropped
- maximumSimilarMessages: an integer which defines how many of a certain notice to display, before summarising and saying something like *99 similar errors suppressed*zero means don't ever summarise noticesdefaults to 3

## Still To Do

Still unfinished (in rough priority order):

1. Checking of general markdown and naked links (esp. in plain text and markdown files)
1. Write the correct checks for the forthcoming new TSV annotation formats
1. Work through all [Issues](https://github.com/unfoldingWord/uw-content-validation/issues)
1. Work through all `ToDo`s in code
1. Standardise parameters according to best practice (i.e., dereferencing, etc.) -- might be too late now???
1. Testing and fine-tuning of error messages (e.g., comparing with tX), especially suppression of false alarms
1. Standardise parameters according to best practice (i.e., dereferencing, etc.)—might be too late now???
1. Document the API with (JsDoc)
1. Improve general documentation in the code and readMe files
1. Is our `RepoCheck` the same as `ResourceContainerCheck`? Or is the latter more specific?
Expand All @@ -134,9 +132,7 @@ Still unfinished (in rough priority order):

Known bugs:

1. Work on removing false alarms for end-users is not yet completed
1. Work on checking links (esp. naked links) in text files is not yet completed
1. Work on checking the forthcoming TSV annotation files is not yet completed.
1. Work on checking naked links in text files is not yet completed

## Functionality and Limitations

Expand All @@ -153,7 +149,7 @@ Once you have this codebase forked and cloned to your local machine, you can sta
1. Ensure that the Styleguide is running by visiting `localhost:6060` on your web browser. (for Chromebooks see note below)
1. Modify the code and documentation in your code editor and check out the Styleguide.
- Update the styleguide.config.js to match your new component names.
1. See debug `console.log()` output in browser console -- in chrome, CTRL-SHIFT-J to open.
1. See debug `console.log()` output in browser consolein chrome, CTRL-SHIFT-J to open.

### Setting up NPM Publishing

Expand Down
13 changes: 10 additions & 3 deletions makeNoticeList.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
# print("file", name, os.path.join(root, name))
with open(os.path.join(root, name), 'rt') as sourceFile:
for n, line in enumerate(sourceFile, start=1):
if 'addNotice' in line and 'function addNotice' not in line \
if ('addNotice' in line or '{ priority:' in line) \
and 'function addNotice' not in line \
and 'console.log' not in line and 'console.assert' not in line \
and 'noticeEntry' not in line \
and 'oticeEntry' not in line \
and 'grammarCheckResult.error' not in line \
and 'MORE SIMILAR' not in line \
and '...' not in line:
strippedLine = line.strip()
# print("\n", os.path.join(root, name), strippedLine)
Expand All @@ -26,7 +28,12 @@
.replace('addNotice6to7','') \
.replace('addNotice5','').replace('addNotice6','').replace('addNotice8','').replace('addNotice9','') \
.replace('addNoticePartial','').replace('addNotice10','') \
.replace('addNotice','')
.replace('addNotice','') \
.replace('checkBookPackageResult.noticeList.push({', '') \
.replace('rawCRResults.noticeList.push({', '') \
.replace('ctqResult.noticeList.push({', '') \
.replace('checkFileResult.noticeList.unshift({', '') \
.replace('let rawCFResults = { noticeList: [{', '')
if cleanedLine.startswith('('): cleanedLine = cleanedLine[1:]
cleanedLine = cleanedLine.replace('{','').replace('}','')
adjustedLine = cleanedLine.replace(', ourAtString','').replace(', atString','') \
Expand Down
Loading