Skip to content

Commit

Permalink
Set DocumentationBaseURL and DocumentationExtension
Browse files Browse the repository at this point in the history
This allows `ruby-lsp` to link to cop documentation for this extension.

Documentation here is in markdown and rubocop didn't support that until
recently, so only set this when it supports both options.
Otherwise it would link to non-existant html docs.
  • Loading branch information
Earlopain committed Sep 4, 2024
1 parent f108619 commit 07adee0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/rubocop/sorbet/inject.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class << self
def defaults!
path = CONFIG_DEFAULT.to_s
hash = ConfigLoader.send(:load_yaml_configuration, path)
if Gem::Version.new(RuboCop::Version::STRING) >= Gem::Version.new("1.66")
# We use markdown for cop documentation. Unconditionally setting
# the base url will produce incorrect urls on older RuboCop versions,
# so we do that for fully supported version only here.
hash["Sorbet"] ||= {}
hash["Sorbet"]["DocumentationBaseURL"] = "https://github.com/Shopify/rubocop-sorbet/blob/main/manual"
hash["Sorbet"]["DocumentationExtension"] = ".md"
end
config = Config.new(hash, path).tap(&:make_excludes_absolute)
puts "configuration from #{path}" if ConfigLoader.debug?
config = ConfigLoader.merge_with_default(config, path)
Expand Down

0 comments on commit 07adee0

Please sign in to comment.