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

Create tool to validate standalone XEP-0001 conformance #1235

Closed
horazont opened this issue Nov 5, 2022 · 0 comments
Closed

Create tool to validate standalone XEP-0001 conformance #1235

horazont opened this issue Nov 5, 2022 · 0 comments
Labels
Editor Tooling Issue relates to process/tooling

Comments

@horazont
Copy link
Contributor

horazont commented Nov 5, 2022

Summary

While a lot of things are already covered by xep.dtd, some more complex
requirements from XEP-0001 need to be checked manually currently. This is
error-prone and should be automated as far as feasible.

Work Proposal

  • Create a command-line utility which takes a single XEP filename as input (stdin won't work, see below)

  • Validate the input file against the following criteria

    • Optional: Check DTD conformance against xep.dtd

    • If the filename matches xep-[0-9]{4}.xml: check that the number in the filename equals /xep/header/number (XPath)

    • If the filename does not match xep-[0-9]{4}.xml, check:

      • That the /xep/header/status (XPath) is ProtoXEP
      • That the /xep/header/number (XPath) is literally XXXX
      • That the name does not start with xep-[0-9]
    • Check that /xep/header/status (XPath) is a defined status (see tools/xeplib.py for an enum)

    • Check that /xep/header/type (XPath) is defined in XEP-0001

      • If the XEP number is less than 400, also accept some legacy values. To find which, see which you encounter in the XEP numbers below 400 :-).
    • Check that /xep/header/approver (XPath) is either Board or Council

    • Check that the version numbers in the revision blocks are descending (from top to bottom in the document)

    • If the approver (see above) is Board, enforce that /xep/header/type is not Standards Track.

    • Check that it uses the xep.xsl XML stylesheet.

    • Check that it includes the correct legal notice (either by checking for the entity reference, or by checking the content)

@horazont horazont added the Editor Tooling Issue relates to process/tooling label Nov 5, 2022
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
As per @horazont's feedback: `-u` shouts at you if you use an undefined variable (very useful to catch typos)
and `-o pipefail` improves error handling by also failing if any of the commands in a pipe fail.
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
As per @horazont's feedback:
> You do not need () around the command in an if. I think that causes a subshell to spawn, the effects of which I'm not certain about.

Further Googling suggests that the exit status of a pipeline is that of the most recently executed foreground pipeline, meaning that the exit code can be used directly in conditional statements.
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
As per @horazont's feedback:
> Whenever you reference a variable ($foobar) and unless you know what you're doing, put it in double quotes.
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
This adds a check for the usage of the _entity reference_ that is the legal notice.
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
xmllint will return exit code 10 when an XPATH query finds no matches. With the changes in this commit, the script isn't stopped. Instead, it uses an empty value, which is likely to cause the validation checks (further down in the script) to fail.
guusdk added a commit to guusdk/xeps that referenced this issue Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editor Tooling Issue relates to process/tooling
Projects
None yet
Development

No branches or pull requests

1 participant