MobiFlight / HubHop-Website

2 stars 1 forks source link

Hubhop needs some quality control checks #51

Closed JaimeLeon2 closed 2 years ago

JaimeLeon2 commented 3 years ago

Hubhop has little in quality control checks in event names. A simple typo error of having left two spaces at the end of an event name went unnoticed. The error is obvious, but invisible to human eyes. Hubhop only converted the first space to an underscore and left the other space. This is what ended up in events.txt:

A32NX_FCU_SPD_PULL_ #(>K:A32NX.FCU_SPD_PULL)

It would be very good to implement some basic quality control checks on the name to prevent these unintended mistakes. Here are three that come to mind:

  1. There should not be any leading or trailing spaces in the name. Actually, I think the event name should start and end with alphanumeric characters; no special characters or spaces at the beginning or end. Are they allowed in the middle? If not, they should be stripped out. Hubhop should strip those when entering the event.

  2. I am of the opinion that there should be consistency in the event names. Event names should be exactly the same in Hubhop and events.txt. Anything else can be confusing for the users. Automatically converting spaces and periods to underscores should be enforced in the Hubhop name (no conversion is necessary then for events.txt). For example the same event name above is listed in Hubhop as

    A32NX.FCU_SPD_PULL. but it is A32NX_FCU_SPD_PULL in events.txt

  3. Use of upper and lower case characters. Event names are case insensitive in the wasm module and MSFS, "ABC_DEF" event name is the same event as "abc_def" and "Abc_Def" (and if present, they will be overwritten by the last instance), so I suggest to standardize on all upper case and enforce this when entering all events names. Lower case characters in the code are OK as they are currently used by developers and users in some variable names although variable names are really case insensitive.

JaimeLeon2 commented 2 years ago

With 4,500 events already in the database, it is impossible to know if there are duplicate event names. Hubhop should also verify this and not allow event names to be duplicated if they already exist.

JaimeLeon2 commented 2 years ago

It again happened that someone created events in Hubhop for the AS3X by pasting from somewhere else and inadvertently had one space in front of the name. Hubhop mistakenly converted the space to a preceding underscore when translating the event to events.txt. The error is obvious but invisible. Hubhop needs to check and correct these things.

rofl-er commented 2 years ago

With 4,500 events already in the database, it is impossible to know if there are duplicate event names. Hubhop should also verify this and not allow event names to be duplicated if they already exist.

Will check that.

It again happened that someone created events in Hubhop for the AS3X by pasting from somewhere else and inadvertently had one space in front of the name. Hubhop mistakenly converted the space to a preceding underscore when translating the event to events.txt. The error is obvious but invisible. Hubhop needs to check and correct these things.

This has to be done within the API. @MobiFlight-Admin could you assist in that matter, please?

rofl-er commented 2 years ago

Fixed with new hubhop version