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

Lint Metaschema Definitions for Trailing and Leading Whitespace #31

Open
5 tasks
Tracked by #33
aj-stein-nist opened this issue Dec 6, 2022 · 3 comments
Open
5 tasks
Tracked by #33
Assignees
Labels
enhancement New feature or request

Comments

@aj-stein-nist
Copy link
Contributor

aj-stein-nist commented Dec 6, 2022

User Story

As a Metaschema developer, I want consistent, clean documentation of the Metaschema-based model definitions, and want them to follow a consistent style, including with use of whitespace.

Goals

  • Add Schematron validation to detect and remove leading and trailing whitespace in Metaschema definitions
  • Automate enforcement of it in the Metaschema repo's CI/CD pipelines in GitHub, and be reusable by the OSCAL repo or other repos

Dependencies

N/A

Acceptance Criteria

  • All Metaschema website and readme documentation affected by the changes in this issue have been updated. Changes to the Metaschema website can be made in the docs/content directory of your branch.
  • A Pull Request (PR) is submitted that fully addresses the goals of this User Story. This issue is referenced in the PR.
  • The CI-CD build process runs without any reported errors on the PR. This can be confirmed by reviewing that all checks have passed in the PR.
@aj-stein-nist aj-stein-nist added the enhancement New feature or request label Dec 6, 2022
@aj-stein-nist aj-stein-nist transferred this issue from usnistgov/OSCAL Dec 6, 2022
@aj-stein-nist aj-stein-nist self-assigned this Jan 3, 2023
@david-waltermire
Copy link
Collaborator

This can be done in the composition check.

@aj-stein-nist
Copy link
Contributor Author

Per discussion with team reorganization, I will move this Metaschema issue off the NIST OSCAL workboard.

@david-waltermire david-waltermire transferred this issue from usnistgov/metaschema Jun 30, 2023
@wendellpiez
Copy link
Collaborator

This request is okay with me, but nothing is stopping OSCAL from having its own Schematron for its own metaschemas, as well.

To the extent there is a spec here at all, is it more or less reducible to XPath

string(.) = normalize-space(.)

which confirms that there are no runs of whitespace and no leading or trailing whitespace?

A check only for leading/trailing space could look like this:

string(.) = replace(.,'^\S*|\S*','')

Questions:

  • which of these is preferable? only prohibiting leading/trailing ws, or prohibiting any redundant (no/op) ws including leading/trailing?
  • which metaschema elements are implicated? Maybe formal-name and description?
  • please confirm, we want this in Schematron in this repo such as the 'Schematron simple check', or a functional equivalent? (alternative being a Schematron to be maintained with the metaschemas.)
  • finally - certain XML editors have a bad way of messing up whitespace in files being edited. When they do so, it can ordinarily be remedied fairly easily (happy to describe further).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants