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

rubocop: Only enable Style/Documentation for @api public code #14818

Merged
merged 9 commits into from Feb 28, 2023

Conversation

issyl0
Copy link
Member

@issyl0 issyl0 commented Feb 26, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

@BrewTestBot
Copy link
Member

Review period will end on 2023-02-28 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 26, 2023
Library/Homebrew/utils.rb Outdated Show resolved Hide resolved
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

This is nice! Would be also cool if we could somehow detect if private APIs are used in brew style one day (not in this PR!) so we can warn about them (CC @dduugg for @Bo98 if you have any ideas).

Found the public API paths with git grep -l "@api public".

The only thing I wonder here is if it'd be nice to turn the above, in this PR, into a CI check so stop this list getting out of sync?

Library/.rubocop.yml Outdated Show resolved Hide resolved
Library/.rubocop.yml Show resolved Hide resolved
Library/Homebrew/utils.rb Outdated Show resolved Hide resolved
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 28, 2023
@BrewTestBot
Copy link
Member

Review period ended.

- Suggested in Homebrew#14709 (comment).
- Found the public API paths with `git grep -l "@api public"`.
- This `Homebrew/utils.rb` file contains one `@api public` method so it's now
  included in `Style/Documentation`.
- This method not having a comment was causing the style specs to fail because
  this file isn't usually failing RuboCop.
- And the test description was confusing so I improved it.
- This is better in the `Library/Homebrew/.rubocop.yml` since it's
  operating on files that are within that directory.
- This will stop the `Style/Documentation` filepath includes getting out of
  sync with what we declare as a public API, thus ensuring that everything is
  documented.
- Maybe we could also add a job here to check that _all_ the paths in the
  RuboCop config still exist, but that's for another time.
- The `Kernel` module, which needed a comment because it has an "@api public"
  method in it, moved.
@issyl0
Copy link
Member Author

issyl0 commented Feb 28, 2023

The only thing I wonder here is if it'd be nice to turn the above, in this PR, into a CI check so stop this list getting out of sync?

Done!

issyl0 and others added 2 commits February 28, 2023 12:50
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
- The slowest part of the separate workflow was the repo checkout step,
  so include it in here to avoid the overhead.
@issyl0 issyl0 merged commit a2b488c into Homebrew:master Feb 28, 2023
@issyl0 issyl0 deleted the rubocop-documentation branch February 28, 2023 13:47
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 31, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants