silverstripe / developer-docs

Developer documentation for Silverstripe CMS
Other
6 stars 61 forks source link

Add linting for docs #11

Closed GuySartorelli closed 10 months ago

GuySartorelli commented 2 years ago

We don't currently have any automated checks to validate the quality of our documentation. This means we might potentially have now - or could easily introduce in the future - markdown formatting issues, incorrectly formatted links, etc. This is especially likely to happen with some of the custom markdown syntax such as API links.

Proposed automated checks:

This should be run on all PRs automatically via github actions.

NOTE: Linting should respect Silverstripe's writing style guide (only accessible to Silverstripe employees currently)

potentially useful tools

Related issues

Notes

Acceptance criteria

TODO

These will be done after the first lot of PRs are merged.

PRs

DO NOT CLOSE UNTIL ALL TODO ITEMS ARE COMPLETE

maxime-rainville commented 2 years ago

Ping @silverstripe/core-team

maxime-rainville commented 2 years ago

That sounds imminently sensible. If no one raises concern over the next week or so, I would just say go ahead and do it.

GuySartorelli commented 2 years ago

Found this issue which points out some issues that might be detectable with this (and some which probably aren't as I assume we don't want to pay for grammarly): https://github.com/silverstripe/developer-docs/issues/37

GuySartorelli commented 2 years ago

Also relevant: https://github.com/silverstripe/developer-docs/issues/13

emteknetnz commented 2 years ago

Don't think we need an RFC for maintenance tasks

Was this only for markdown files in the developer-docs repo, or would it also apply to the userhelp docs, and maybe even module readmes (probably not required?)

GuySartorelli commented 2 years ago

I was only thinking about developer docs specifically, but I guess it could apply to userhelp too - that's hosted by the same app so the linting rules should all be the same. I don't think it would apply to readmes in repos.

GuySartorelli commented 2 years ago

I'm gonna go ahead and mark this accepted

GuySartorelli commented 11 months ago

Note that while we could use something like https://github.com/greyscaled/markdownlint-rule-title-case-style to lint the heading style to ensure it's always using sentence style, we'd have to either:

  1. Implement an "ignore code" feature for the rule and only allow exceptions within code tags (e.g. ## My `ModelAdmin` heading)
  2. add a whooole load of "words" (e.g. PHP, ModelAdmin, etc) to the ignore list
  3. add a whooool load of "ignore the rule for the next line" comments in the docs (ew)
  4. Explicitly not allow any exceptions

That first option is feasible but out of scope for this first card. The other options are non-starters IMO. So for now we won't lint heading style.

EDIT: The maintainer of that package has kindly implemented that for us.

GuySartorelli commented 11 months ago

I've made a wrapper around php code sniffer which lets you lint code blocks inside markdown files https://github.com/GuySartorelli/md-php-cs

emteknetnz commented 10 months ago

Assigned back to @GuySartorelli for the other TODO items

GuySartorelli commented 10 months ago

Merged up to 5. I looked at the line length changes and it was just waaaaaay too much to do in one go. If we really care about that rule we can do it in chunks, but that's basically an epic in itself.