Skip to content
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
25 changes: 19 additions & 6 deletions .validators/validator_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os
import io
import sys
import inspect
from pprint import pprint

import requests
from hashlib import sha256
Expand All @@ -18,6 +20,7 @@

api_url = os.environ.get('APPVEYOR_API_URL')
has_error = False
all_errors = []

# constants for creation of UDL list overview
c_line_break = '\x0d'
Expand Down Expand Up @@ -55,9 +58,13 @@ def post_error(message):
if api_url:
requests.post(api_url + "api/build/messages", json=message)
else:
from pprint import pprint
pprint(message)

global all_errors
caller_frame = inspect.stack()[1]

all_errors.append(f'line#{caller_frame.lineno} in {caller_frame.function}(): {message["message"]}')

def first_two_lines(description):
if len(description) <= c_sum_len:
return ""
Expand Down Expand Up @@ -447,7 +454,7 @@ def parse(filename):
post_error(f'{udl["display-name"]}: UDL internal name check could not find <UserLang name="..."> for comparison')
elif any(char in udl_internal_name for char in ('<', '>', ':', '"', '/', '\\', '|', '?', '*')):
post_error(f'{udl["display-name"]}: UDL internal name check found invalid character in <UserLang name="{udl_internal_name}"...> tag')
sys.exit(-2)
sys.exit(-2) # stop immediately; not safe to continue

# look at optional autoCompletion
if "autoCompletion" in udl:
Expand All @@ -472,7 +479,7 @@ def parse(filename):
# audit internal name vs display-name, which are required to match for autoCompletion
if udl_internal_name != udl["display-name"]:
post_error(f'{udl["display-name"]}: JSON:{{"autoCompletion": true}}, but XML:<UserLang name="{udl_internal_name}"> is different than JSON:{{"display-name": "{udl["display-name"]}"}}, so please fix to have JSON:{{"display-name": "{udl_internal_name}"}} to match')
sys.exit(-2)

elif udl["autoCompletion"][0:4] == "http":
ac_link = udl["autoCompletion"]
else:
Expand All @@ -482,13 +489,13 @@ def parse(filename):
ac_link = udl_internal_name + ".xml"

# audit internal name vs display-name name: recommend to match
if udl_internal_name != udl["display-name"]:
print(f' !! XML:<UserLang name="{udl_internal_name}"> is different than JSON:{{"display-name": "{udl["display-name"]}"}}: CONTRIBUTING.md recommends those two should match if possible !!')
if udl_internal_name.casefold() != udl["display-name"].casefold():
print(f' ! WARNING: XML:<UserLang name="{udl_internal_name}"> is different than JSON:{{"display-name": "{udl["display-name"]}"}}: CONTRIBUTING.md recommends those two should match if possible')

# audit internal name vs autoCompletion text name: MUST match
if udl_internal_name.casefold() != udl["autoCompletion"].casefold():
post_error(f'{udl["display-name"]}: autoCompletion file name mismatch: JSON indicates filename="{udl["autoCompletion"]}.xml" but N++ autoCompletion naming rules requires it at filename="{ac_link}"')
sys.exit(-2)

ac_link_abs = Path(os.path.join(os.getcwd(),"autoCompletion", ac_link))
udl["_ac_link"] = ac_link
udl["_ac_link_abs"] = ac_link_abs
Expand Down Expand Up @@ -519,6 +526,10 @@ def parse(filename):
if "functionList" in udl:
# print(f'\tfunctionList: {udl["functionList"]}')
if udl["functionList"]:
# audit internal name vs display-name, which are required to match for functionList
if udl_internal_name.casefold() != udl["display-name"].casefold():
post_error(f'{udl["display-name"]}: JSON:{{"functionList": {udl["functionList"]}}}, but XML:<UserLang name="{udl_internal_name}"> is different than JSON:{{"display-name": "{udl["display-name"]}"}}, so please fix to have JSON:{{"display-name": "{udl_internal_name}"}} to match')

if str(udl["functionList"]) == "True":
fl_link = udl["id-name"] + ".xml"
elif udl["functionList"][0:4] == "http":
Expand Down Expand Up @@ -598,6 +609,8 @@ def parse(filename):
md_file.write(gen_md_table(udl_file_structure))

if has_error:
print('\r\nSummary of Errors:')
print('\r\n'.join(['!! ' + str(x) for x in all_errors]))
sys.exit(-2)
else:
sys.exit()
6 changes: 3 additions & 3 deletions udl-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@
},
{
"id-name": "dBASEPlus_LightTheme_byLycanThrope",
"display-name": "dBASEPlus_LightTheme",
"display-name": "dBASEPlus (Light Theme)",
"version": "2024-Feb-03",
"repository": "",
"description": "dBASE Plus (Light Theme)",
Expand All @@ -900,7 +900,7 @@
},
{
"id-name": "dBASEPlus_DarkTheme_byLycanThrope",
"display-name": "dBASEPlus_DarkTheme",
"display-name": "dBASEPlus (Dark Theme)",
"version": "2024-Feb-03",
"repository": "",
"description": "dBASE Plus (Dark Theme)",
Expand Down Expand Up @@ -3815,4 +3815,4 @@
"autoCompletionAuthor": "generate_ac.py"
}
]
}
}
12 changes: 6 additions & 6 deletions udl-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
| [Dart (DarkModeDefault theme)](./UDLs/Dart_DarkModeDefault.xml) | NBA2K1 | Dart for the DarkModeDefault theme |
| [Datcom (input and output)](./UDLs/DatcomIO_by_StuartBowman.xml) | [Stuart Bowman](mailto:[email protected]) | Datcom (input and output) |
| [DAX](./UDLs/DAX_bySaschaKasper.xml) | [Sascha D. Kasper](https://sascha-kasper.com/dax-syntax-highlighting-for-notepad/) | DAX Data Visualization (Microsoft Power BI) |
| [dBASEPlus_DarkTheme](./UDLs/dBASEPlus_DarkTheme_byLycanThrope.xml) | Lycan Thrope | dBASE Plus (Dark Theme) |
| [dBASEPlus_LightTheme](./UDLs/dBASEPlus_LightTheme_byLycanThrope.xml) | Lycan Thrope | dBASE Plus (Light Theme) |
| [dBASEPlus (Dark Theme)](./UDLs/dBASEPlus_DarkTheme_byLycanThrope.xml) | Lycan Thrope | dBASE Plus (Dark Theme) |
| [dBASEPlus (Light Theme)](./UDLs/dBASEPlus_LightTheme_byLycanThrope.xml) | Lycan Thrope | dBASE Plus (Light Theme) |
| [DCL](./UDLs/DCL_by-wolfxx.xml) | [Wolfgang Walhütter](mailto:[email protected]) | DCL |
| [Delphi Forms](./UDLs/DelphiForms_by-ewgbel.xml) | [Ewgenij Belzmann](mailto:[email protected]) | Delphi Forms |
| [DinkC](./UDLs/DinkC_by-sparrowhawk76.xml) | [Y.V.](mailto:[email protected]) | DinkC |
Expand Down Expand Up @@ -461,8 +461,8 @@
| [Dart (DarkModeDefault theme)](./autoCompletion/Dart%20%28DarkModeDefault%20theme%29.xml) | generate_ac.py | Dart for the DarkModeDefault theme |
| [Datcom (input and output)](./autoCompletion/Datcom%20Input.xml) | generate_ac.py | Datcom (input and output) |
| [DAX](./autoCompletion/DAX.xml) | [Sascha D. Kasper](https://sascha-kasper.com/dax-syntax-highlighting-for-notepad/) | DAX Data Visualization (Microsoft Power BI) |
| [dBASEPlus_DarkTheme](./autoCompletion/dBASEPlus%20%28Dark%20Theme%29.xml) | Lycan Thrope | dBASE Plus (Dark Theme) |
| [dBASEPlus_LightTheme](./autoCompletion/dBASEPlus%20%28Light%20Theme%29.xml) | Lycan Thrope | dBASE Plus (Light Theme) |
| [dBASEPlus (Dark Theme)](./autoCompletion/dBASEPlus%20%28Dark%20Theme%29.xml) | Lycan Thrope | dBASE Plus (Dark Theme) |
| [dBASEPlus (Light Theme)](./autoCompletion/dBASEPlus%20%28Light%20Theme%29.xml) | Lycan Thrope | dBASE Plus (Light Theme) |
| [DCL](./autoCompletion/DCL.xml) | generate_ac.py | DCL |
| [Delphi Forms](./autoCompletion/Delphi%20Form.xml) | generate_ac.py | Delphi Forms |
| [DinkC](./autoCompletion/DinkC.xml) | generate_ac.py | DinkC |
Expand Down Expand Up @@ -724,8 +724,8 @@ _If you download a functionList definition, remember to add the `<association>`
| Name | Author | Description | overrideMap `<association>` |
|------|--------|-------------|-----------------------------|
| [Cython](./functionList/Cython_byFrederikLauf.xml) | generate_ac.py | Cython Syntax Highlighting | `<association id="Cython_byFrederikLauf.xml" userDefinedLangName="Cython" />` |
| [dBASEPlus_DarkTheme](./functionList/dbaseplus.xml) | Lycan Thrope | dBASE Plus (Dark Theme) | `<association id="dbaseplus.xml" userDefinedLangName="dBASEPlus_DarkTheme" />` |
| [dBASEPlus_LightTheme](./functionList/dbaseplus.xml) | Lycan Thrope | dBASE Plus (Light Theme) | `<association id="dbaseplus.xml" userDefinedLangName="dBASEPlus_LightTheme" />` |
| [dBASEPlus (Dark Theme)](./functionList/dbaseplus.xml) | Lycan Thrope | dBASE Plus (Dark Theme) | `<association id="dbaseplus.xml" userDefinedLangName="dBASEPlus (Dark Theme)" />` |
| [dBASEPlus (Light Theme)](./functionList/dbaseplus.xml) | Lycan Thrope | dBASE Plus (Light Theme) | `<association id="dbaseplus.xml" userDefinedLangName="dBASEPlus (Light Theme)" />` |
| [LSL](./functionList/LSL_byKimpaTammas.xml) | [Kimpa Tammas](mailto:[email protected]) | Linden Script Language (dark theme version) | `<association id="LSL_byKimpaTammas.xml" userDefinedLangName="LSL" />` |
| [STL 3dObject](./functionList/STL-3dObject-ASCII.byPryrt.xml) | generate_ac.py | 3d Stereolithography ASCII file (STL) | `<association id="STL-3dObject-ASCII.byPryrt.xml" userDefinedLangName="STL 3dObject" />` |
| [Vim script](./functionList/Vimscript_by_rdipardo.xml) | Pryrt | User Defined Language for Vim script | `<association id="Vimscript_by_rdipardo.xml" userDefinedLangName="Vim script" />` |
Loading