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

Use --unsafe YAML check for mkdocs.yml #911

Merged
merged 1 commit into from
Aug 10, 2022

Conversation

StevenMaude
Copy link
Contributor

See pre-commit/pre-commit-hooks#273

The check currently fails because we use the !! syntax in the current
mkdocs.yml configuration.

--unsafe refers to the YAML compliance: it doesn't load the file, merely
checks the syntax:

Instead of loading the files, simply parse them for syntax.
A syntax-only check enables extensions and unsafe constructs which would otherwise be forbidden.
Using this option removes all guarantees of portability to other yaml implementations.

https://github.com/pre-commit/pre-commit-hooks/blob/98c88b23b7ea9a42f920adc1d7c8790f39772021/README.md#check-yaml

This is still better than the current situation because:

  • a complete failure requires a committer to use --no-verify
    or spend time trying to work out what's wrong with the pre-commit
    failure
  • there is still a rudimentary check of this YAML, which doesn't happen
    in the current broken state

In practice, this YAML file gets loaded by MkDocs, which tells us if it's broken
anyway.

Other YAML files in this repository are still checked fully.

See pre-commit/pre-commit-hooks#273

The check currently fails because we use the `!!` syntax in the current
`mkdocs.yml` configuration.

`--unsafe` refers to the YAML compliance: it doesn't load the file, merely
checks the syntax:

> Instead of loading the files, simply parse them for syntax.
> A syntax-only check enables extensions and unsafe constructs which would otherwise be forbidden.
> Using this option removes all guarantees of portability to other yaml implementations.

https://github.com/pre-commit/pre-commit-hooks/blob/98c88b23b7ea9a42f920adc1d7c8790f39772021/README.md#check-yaml

This is still better than the current situation because:

* a complete failure requires a committer to use `--no-verify`
  or spend time trying to work out what's wrong with the pre-commit
  failure
* there is still a rudimentary check of this YAML, which doesn't happen
  in the current broken state

In practice, this YAML file gets loaded by MkDocs, which tells us if it's broken
anyway.

Other YAML files in this repository are still checked fully.
@render
Copy link

render bot commented Aug 10, 2022

@render
Copy link

render bot commented Aug 10, 2022

Your Render PR Server at https://opensafely-documentation-pr-911.onrender.com is now live!

View it on your dashboard at https://dashboard.render.com/static/srv-cbprhqarrk09aurpn2c0.

@StevenMaude StevenMaude merged commit c8be109 into main Aug 10, 2022
@StevenMaude StevenMaude deleted the steve/skip-mkdocs-yaml-loading-in-pre-commit branch August 10, 2022 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants