Skip to content

Draft: Rake task to generate rubocop docs

Keeyan Nejad requested to merge rake-task-to-generate-rubocop-docs into master

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 😁, just in terms of general approach).

Here's what's left:

  • Check with the gitlab-docs-hugo developers whether using and enabling adoc 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

Screenshot_from_2024-11-14_17-32-22

Screenshot_from_2024-11-14_17-32-33

Screenshot_from_2024-11-14_17-32-44

How to set up and validate locally

  1. Enable gitlab-docs-hugo as described in GDK docs
  2. Also follow the steps for Run migration scripts
  3. Checkout the support-asciidoctor branch in gdk-path/gitlab-docs-hugo
  4. Run gdk reconfigure
  5. Visit http://172.16.123.1:1313/rubocop/cops (or wherever you host your GitLab instance, but with port 1313)
  6. Edit the comment for rubocop/cop/rake/require.rb
  7. Run rails rubocop:docs
  8. Run gdk reconfigure again
  9. See the change reflected in http://172.16.123.1:1313/rubocop/cops_rake/#rakerequire
Edited by Keeyan Nejad

Merge request reports

Loading