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

Create automatic documentation based on the cop's descriptions #51

Merged
merged 12 commits into from
Aug 4, 2023

Conversation

MassimilianoLattanzio
Copy link
Collaborator

@MassimilianoLattanzio MassimilianoLattanzio commented Jul 28, 2023

This PR adds the ability to create docs based on the cop's description directly.

To create new docs, run the bundle exec rake task, automatically creating all the relative files and checking if the provided examples contain any ruby parsing error.

This PR also contains some improvements, not strictly related to the PR topic:

@MassimilianoLattanzio MassimilianoLattanzio added the documentation Improvements or additions to documentation label Jul 28, 2023
@MassimilianoLattanzio MassimilianoLattanzio self-assigned this Jul 28, 2023
@MassimilianoLattanzio MassimilianoLattanzio force-pushed the ml/documentation branch 2 times, most recently from 861a855 to 47262be Compare August 1, 2023 09:52
@MassimilianoLattanzio MassimilianoLattanzio marked this pull request as ready for review August 1, 2023 09:55
@MassimilianoLattanzio MassimilianoLattanzio changed the title Documentation Create automatic documentation based on the cop's descriptions Aug 1, 2023
Copy link
Contributor

@abhishekgupta5 abhishekgupta5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am finding this PR hard to review -

  • Seems like the PR is doing much more what the title of the PR states
  • In case, it's doing other stuff, can we mention it in the root comment of the PR as bullet points?
  • Some commit messages are not stating why the change is needed / have been added

Import docs generator rake task from Shopify/rubocop-sorbet@76e7634.

This allow us to create docs based on the cop's description.
Some cop descriptions still need to be written,
and others don't have relatively bad/good examples.

So we updated all descriptions and regenerated the docs.
In this way a documentation link will be shown in the Rubygems page.
@MassimilianoLattanzio MassimilianoLattanzio force-pushed the ml/documentation branch 3 times, most recently from e5afd40 to 767b90e Compare August 3, 2023 16:43
@MassimilianoLattanzio
Copy link
Collaborator Author

I am finding this PR hard to review -

  • Seems like the PR is doing much more what the title of the PR states
  • In case, it's doing other stuff, can we mention it in the root comment of the PR as bullet points?
  • Some commit messages are not stating why the change is needed / have been added

I've updated the PR with your suggestion. Let me know if now everything is clear.

@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://www.github.com/solidusio/rubocop-solidus'
spec.metadata['changelog_uri'] = 'https://www.github.com/solidusio/rubocop-solidus'
spec.metadata['documentation_uri'] = 'https://www.github.com/solidusio/rubocop-solidus/blob/master/docs/cops.md'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Copy link
Contributor

@abhishekgupta5 abhishekgupta5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR. LGTM

- name: Lint files
run: bundle exec rake rubocop
- name: Run tests
run: bundle exec rake spec
Copy link
Contributor

@abhishekgupta5 abhishekgupta5 Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, is this same as - bundle exec rspec spec?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

rubocop-solidus/Rakefile

Lines 13 to 15 in c62eb78

RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = FileList['spec/**/*_spec.rb']
end

After adding the documentation uri to the gemspec
we found a typo in the changelog uri too, so this commit
fixes the typo.
When we run rubocop, it will raise a tip regaring suggested exentions.
Those extensions are not useful for us, so we disabled the tip.

Result after running rubocop:
Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
  * rubocop-rake (https://rubygems.org/gems/rubocop-rake)
  * rubocop-rspec (https://rubygems.org/gems/rubocop-rspec)

You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
  AllCops:
    SuggestExtensions: false
This commit contains some improvements for the CI:
- Renamed from `Tests` to `CI` because it doesn't run only tests.
- Removed `bundle install` step because it's already done in `Setup`.
- Created single steps for each rake task.

Especially the last point is useful because by separating the step/task,
we can easily find and fix which task is failing (if any) and fix it.
This commit contains an improvement on the README readability.

Previously, all sections of the README had the same importance.
Now we created 4 main sections (Getting started, Documentation,
Contributing and License) and moved all other sub-sections under
the right top-level section.
@MassimilianoLattanzio MassimilianoLattanzio merged commit 5fb178c into master Aug 4, 2023
4 checks passed
@MassimilianoLattanzio MassimilianoLattanzio deleted the ml/documentation branch August 4, 2023 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants