Draft: Rake task to generate rubocop docs
What does this MR do and why?
This is a very early draft of a way to generate documentation for all our Rubocop cops automatically, which is compatible with our gitlab-docs-hugo repository (not the old Nanoc ones).
It pulls in some existing code from Rubocop (slightly altered) to generate adoc
files and copies these to the right location so that Hugo can display them.
There's a lot left to do, but I wanted to get something out to show and get some early feedback (not in terms of code quality, it's a mess at the moment
Here's what's left:
- Check with the
gitlab-docs-hugo
developers whether using and enablingadoc
is acceptable, or whether we should convert them to MarkDown first - Decide what to do with the code I borrowed from Rubocop. Either inherit from the existing code (which is risky since it's marked as private) or re-write our own to suite our needs better, or keep extending it and attribute it correctly.
- Pull in the docs for cops in
gitlab-styles
. - Clean up the code.
- Document how to generate docs when updating cops.
- Remove the "Version Added" and "Version Changed" since it doesn't make sense for GitLab internal cops.
References
Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
How to set up and validate locally
- Enable gitlab-docs-hugo as described in GDK docs
- Also follow the steps for Run migration scripts
- Checkout the
support-asciidoctor
branch ingdk-path/gitlab-docs-hugo
- Run
gdk reconfigure
- Visit http://172.16.123.1:1313/rubocop/cops (or wherever you host your GitLab instance, but with port 1313)
- Edit the comment for rubocop/cop/rake/require.rb
- Run
rails rubocop:docs
- Run
gdk reconfigure
again - See the change reflected in http://172.16.123.1:1313/rubocop/cops_rake/#rakerequire