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

Show doc urls for extension cops #2076

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Conversation

Earlopain
Copy link
Contributor

Requires #2075 and a new RuboCop release.

Motivation

#2022

Implementation

rubocop/rubocop#12907 added what was needed to make this work. Doc urls are dependant on DocumentationBaseURL from the config, which a class method simply doesn't have access to.

So, pass in the config we have from the runner to construct these. Check the method params to stay compatible with both old and new versions.

Automated Tests

Yup

Manual Tests

Open some test file and add a new test case with the following:

  def test_public
    assert_equal([], foo)
  end 

Hover over the diagnostic and check out the hyperlink:
image

Old RuboCop versions will continue to not show these links.

@Earlopain Earlopain marked this pull request as ready for review May 23, 2024 13:44
@Earlopain Earlopain requested a review from a team as a code owner May 23, 2024 13:44
@vinistock vinistock added enhancement New feature or request server This pull request should be included in the server gem's release notes labels May 27, 2024
@Earlopain Earlopain force-pushed the rubocop-doc-urls branch 2 times, most recently from 243f43e to f2d7002 Compare May 27, 2024 18:06
RuboCop 1.64 added support for passing in a config, which will then construct
the correct url for non-buildin departments that have `DocumentationBaseURL` set.
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

@vinistock vinistock merged commit 28978dc into Shopify:main Jun 3, 2024
18 checks passed
@Earlopain Earlopain deleted the rubocop-doc-urls branch June 3, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants