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

Add unused xml detection #1221

Merged
merged 3 commits into from
Aug 23, 2023
Merged

Add unused xml detection #1221

merged 3 commits into from
Aug 23, 2023

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Aug 20, 2023

Lists all elements and attributes that are present in the map XML, but pgm never gets to read. Very useful to find stuff you're doing wrong in xml, where pgm won't even read it, or typos:

A (real) example:

...
<kit id="experts-spade-kit" fdeduct-tools="false" ilter="experts-spade-equipped">
...
community-maps/ctw/standard/nyxis - 'fdeduct-tools' attribute of 'kit' element @ line 182 to 191: Unused node, maybe a typo?
community-maps/ctw/standard/nyxis - 'ilter' attribute of 'kit' element @ line 182 to 191: Unused node, maybe a typo?

Additionally fixed include errors being shown as part of the original file (but in the includes' line numbers), now maps will show (if they have a variant and it happened inside an include) as:
path/to/map[variant]#include - description @ line: message

A setting to be able to control if messages are issued has been added, defaults to true. Recommended to set to false for production servers, but keep it enabled for mapdev enviroments.

<tutorial> tag is explicitly whitelisted to avoid maps that define them being flagged. Also namespaced attributes or elements are ignored to allow 3rd party tags not messing with pgm, eg: <ns:something/>

Signed-off-by: Pablo Herrera <[email protected]>
@Pablete1234 Pablete1234 marked this pull request as ready for review August 21, 2023 21:56
@Pablete1234 Pablete1234 added the ready PR is ready to merge label Aug 21, 2023
Copy link
Member

@Electroid Electroid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, we thought this wasn’t possible for the longest time, glad you found a way.

@Electroid Electroid merged commit 24e8a26 into dev Aug 23, 2023
2 checks passed
@Electroid Electroid deleted the xml-validation branch August 23, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR is ready to merge
Development

Successfully merging this pull request may close these issues.

3 participants