Skip to content

Commit

Permalink
Merge pull request #31 from unfoldingWord/RJHimprovements
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
RobH123 authored Sep 15, 2020
2 parents bb3ceae + 66f2c17 commit 4d150ab
Show file tree
Hide file tree
Showing 46 changed files with 1,263 additions and 760 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jspm_packages/
# TypeScript v1 declaration files
typings/

# VSCode
.vscode

# Optional npm cache directory
.npm
.yalc/
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ There are two compulsory fields in all of these notice objects:

All of the following fields may be missing or undefined, i.e., they're all optional:

1. `details`: More details about the notice (if relevant)
1. `bookID`: The 3-character UPPERCASE [book identifier](http://ubsicap.github.io/usfm/identification/books.html) or [OBS](https://www.openbiblestories.org/) (if relevant)
1. `C`: The chapter number or OBS story number (if relevant)
1. `V`: The verse number or OBS frame number (if relevant)
Expand All @@ -80,13 +81,12 @@ However, the user is, of course, free to create their own alternative version of

Still unfinished (in rough priority order):

1. Finish adding lineNumber, fileName, repoName as separate optional notice fields
1. Standardise parameters according to best practice (i.e., dereferencing, etc.)
1. Testing and fine-tuning of error messages (e.g., comparing with tX), especially suppression of false alarms
1. Optimise various different file fetches and caches (incl. using zips) for the demos
1. Document the API with (JsDoc)
1. Checking of general markdown and naked links (esp. in plain text and markdown files)
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.)
1. Improve general documentation in the code and readMe files
1. Optimise various different file fetches and caches (incl. using zips) for the demos
1. Is our `RepoCheck` the same as `ResourceContainerCheck`? Or is the latter more specific?
1. Understand and standardise React stuff in the demos, e.g., e.g., withStyles, etc.
1. Write unit tests (especially for the core functions) and get them passing, including on GitHub push -- is it Cypress or Jest that's the right tool for this? Or Jest for the core functions? Cypress for some basic tests of the demos?
Expand All @@ -97,10 +97,9 @@ Still unfinished (in rough priority order):

Known bugs:

1. At the moment, the relevant `repoName`, `filename`, and `lineNumber` information is not yet all properly added to the notice objects -- also the `location` field may still contain overlapping information
1. The line number in the USFM Grammar check doesn't account for blank lines, so the real line number may be larger. (This is a bug in the BCS library.)
1. Work on removing false alarms for end-users is not yet completed
1. Work on checking links (esp. naked links) 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.

## Functionality and Limitations

Expand Down
20 changes: 14 additions & 6 deletions makeNoticeList.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,35 @@

for root, dirs, files in os.walk('.'):
for name in files:
if name.endswith('.js') or name.endswith('.ts'):
if '/dist/' not in root \
and name.endswith('.js') or name.endswith('.ts'):
# print("file", name, os.path.join(root, name))
with open(os.path.join(root, name), 'rt') as sourceFile:
for line in sourceFile:
if 'addNotice' in line and 'function addNotice' not in line \
and 'console.assert' not in line and 'noticeEntry.priority' not in line:
and 'console.assert' not in line and 'noticeEntry.priority' not in line \
and 'grammarCheckResult.error' not in line \
and '...' not in line:
strippedLine = line.strip()
# print("\n", os.path.join(root, name), strippedLine)
if strippedLine.endswith(');'): strippedLine = strippedLine[:-2]
if not strippedLine.startswith('//'):
cleanedLine = strippedLine.replace('addNotice6to9','').replace('addNotice6to7','') \
.replace('addNotice6','').replace('addNotice8','').replace('addNotice9','') \
.replace('addNotice5','').replace('addNotice6','').replace('addNotice8','').replace('addNotice9','') \
.replace('addNoticeCV8','').replace('addNotice10','')
if cleanedLine.startswith('('): cleanedLine = cleanedLine[1:]
cleanedLine = cleanedLine.replace('{','').replace('}','')
adjustedLine = cleanedLine.replace(', ourAtString','').replace(', atString','') \
.replace(', ourLocation','').replace(', ourRowLocation','') \
.replace('${ourRowLocation}','') \
.replace('{priority:','').replace('message:','')
noticeList.append(adjustedLine.strip())
.replace('priority:','').replace('message:','')
adjustedLine = adjustedLine.strip().replace(' ',' ')
print("adjustedLine", adjustedLine)
if not adjustedLine: halt
noticeList.append(adjustedLine)
# for name in dirs:
# print("dir", name, os.path.join(root, name))

print(f"Got {len(noticeList)} notices:")
print(f"\nGot {len(noticeList)} notices:")
for notice in sorted(noticeList, reverse=True):
print(f" {notice}")
Loading

0 comments on commit 4d150ab

Please sign in to comment.