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

[Fix #12884] Allow cop_class.documentation_url to take a config #12907

Merged
merged 1 commit into from
May 20, 2024

Conversation

Earlopain
Copy link
Contributor

@Earlopain Earlopain commented May 16, 2024

Fix #12884 (almost). It requires passing in a config object but that seems ok to require.

The current implementation is not very useful to consumers since it requires every extension to overwrite this method.
No official extension currenty does that.

The behaviour of --show-docs-url is almost what's required. It takes a config to construct this url and returns correct results for all official extensions.

The url it provides falls back to the default RuboCop docs url which is undesirable in all cases I can think about. That behaviour has been removed. No 3rd-party extension cops will be found on the RuboCop docs website. Only buildin cops will be found there.

All extensions that provide DocumentationBaseURL will now have result returned by documentation_url without needing to do something themselves (as long as proper config object is passed in)


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

The current implementation is not very useful to consumers since it requires every extension to
overwrite this method.
No official extension currenty does that.

The behaviour of `--show-docs-url` is almost what's required. It takes a config to construct this url.

The url it provides falls back to the default RuboCop docs url which is undesirable in all cases I can think about. That behaviour has been removed.
@bbatsov bbatsov merged commit bc7cd4b into rubocop:master May 20, 2024
33 checks passed
@bbatsov
Copy link
Collaborator

bbatsov commented May 20, 2024

Seems like a reasonable change to me. Thanks!

@Earlopain Earlopain deleted the documentation-url-config branch May 20, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cop.documentation_url is nil for extension cops
2 participants