Skip to content

Commit 173e0eb

Browse files
authored
Merge pull request #17 from ksss/support-old-rubocop
Support rubocop 1.21 ~ 1.46
2 parents 04e636c + 8f4385b commit 173e0eb

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PATH
22
remote: .
33
specs:
44
rubocop-yard (0.8.0)
5-
rubocop
5+
rubocop (~> 1.21)
66
yard
77

88
GEM
@@ -50,11 +50,11 @@ GEM
5050
rbs (3.2.1)
5151
rdoc (6.5.0)
5252
psych (>= 4.0.0)
53-
regexp_parser (2.8.1)
53+
regexp_parser (2.8.2)
5454
reline (0.3.8)
5555
io-console (~> 0.5)
5656
rexml (3.2.6)
57-
rubocop (1.56.2)
57+
rubocop (1.56.4)
5858
base64 (~> 0.1.1)
5959
json (~> 2.3)
6060
language_server-protocol (>= 3.17.0)
@@ -66,7 +66,7 @@ GEM
6666
rubocop-ast (>= 1.28.1, < 2.0)
6767
ruby-progressbar (~> 1.7)
6868
unicode-display_width (>= 2.4.0, < 3.0)
69-
rubocop-ast (1.29.0)
69+
rubocop-ast (1.30.0)
7070
parser (>= 3.2.1.0)
7171
ruby-progressbar (1.13.0)
7272
securerandom (0.2.2)

lib/rubocop/cop/yard/patch.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
# Support for rubocop v1.46.0 or under.
4+
# see also https://github.com/rubocop/rubocop/pull/11630
5+
return if defined? RuboCop::Ext::Comment
6+
7+
module RuboCop
8+
module Ext
9+
# Extensions to `Parser::Source::Comment`.
10+
module Comment
11+
def source
12+
loc.expression.source
13+
end
14+
15+
def source_range
16+
loc.expression
17+
end
18+
end
19+
end
20+
end
21+
22+
Parser::Source::Comment.include RuboCop::Ext::Comment

lib/rubocop/cop/yard_cops.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'yard'
4+
require_relative 'yard/patch'
45
require_relative 'yard/helper'
56
require_relative 'yard/collection_style'
67
require_relative 'yard/collection_type'

rubocop-yard.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
3131
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3232
spec.require_paths = ["lib"]
3333

34-
spec.add_runtime_dependency 'rubocop'
34+
spec.add_runtime_dependency 'rubocop', "~> 1.21"
3535
spec.add_runtime_dependency 'yard'
3636
end
3737

0 commit comments

Comments
 (0)