Skip to content

Commit d366fb2

Browse files
authored
Merge pull request #34 from sue445/migrate_plugin
Migrate to plugin
2 parents b574f3c + 559c503 commit d366fb2

File tree

8 files changed

+52
-37
lines changed

8 files changed

+52
-37
lines changed

.rubocop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
inherit_from: .rubocop_todo.yml
22

3-
require:
4-
'./lib/rubocop-yard'
3+
plugins:
4+
- rubocop-yard
55

66
Layout:
77
Enabled: false

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gemspec
77

88
gem "rake", "~> 13.0"
99

10-
gem "rubocop", "~> 1.21"
10+
gem "rubocop", "~> 1.72"
1111
gem 'debug'
1212
gem 'steep'
1313
gem 'activesupport', '~> 7.0' # 8.0 needs Ruby 3.2

Gemfile.lock

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ PATH
22
remote: .
33
specs:
44
rubocop-yard (0.10.0)
5-
rubocop (~> 1.21)
5+
lint_roller
6+
rubocop (~> 1.72)
67
yard
78

89
GEM
@@ -41,6 +42,7 @@ GEM
4142
reline (>= 0.4.2)
4243
json (2.8.2)
4344
language_server-protocol (3.17.0.3)
45+
lint_roller (1.1.0)
4446
listen (3.9.0)
4547
rb-fsevent (~> 0.10, >= 0.10.3)
4648
rb-inotify (~> 0.9, >= 0.9.10)
@@ -62,20 +64,21 @@ GEM
6264
logger
6365
rdoc (6.8.1)
6466
psych (>= 4.0.0)
65-
regexp_parser (2.9.2)
67+
regexp_parser (2.10.0)
6668
reline (0.5.11)
6769
io-console (~> 0.5)
68-
rubocop (1.68.0)
70+
rubocop (1.74.0)
6971
json (~> 2.3)
70-
language_server-protocol (>= 3.17.0)
72+
language_server-protocol (~> 3.17.0.2)
73+
lint_roller (~> 1.1.0)
7174
parallel (~> 1.10)
7275
parser (>= 3.3.0.2)
7376
rainbow (>= 2.2.2, < 4.0)
74-
regexp_parser (>= 2.4, < 3.0)
75-
rubocop-ast (>= 1.32.2, < 2.0)
77+
regexp_parser (>= 2.9.3, < 3.0)
78+
rubocop-ast (>= 1.38.0, < 2.0)
7679
ruby-progressbar (~> 1.7)
77-
unicode-display_width (>= 2.4.0, < 3.0)
78-
rubocop-ast (1.36.1)
80+
unicode-display_width (>= 2.4.0, < 4.0)
81+
rubocop-ast (1.40.0)
7982
parser (>= 3.3.1.0)
8083
ruby-progressbar (1.13.0)
8184
securerandom (0.3.2)
@@ -110,7 +113,7 @@ DEPENDENCIES
110113
activesupport (~> 7.0)
111114
debug
112115
rake (~> 13.0)
113-
rubocop (~> 1.21)
116+
rubocop (~> 1.72)
114117
rubocop-yard!
115118
steep
116119

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ If bundler is not being used to manage dependencies, install the gem by executin
131131
Put this into your `.rubocop.yml`.
132132

133133
```yaml
134-
require: rubocop-yard
134+
plugins:
135+
- rubocop-yard
135136
```
136137
137138
## Development

lib/rubocop-yard.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
require_relative 'rubocop/yard'
66
require_relative 'rubocop/yard/version'
7-
require_relative 'rubocop/yard/inject'
8-
9-
RuboCop::YARD::Inject.defaults!
7+
require_relative 'rubocop/yard/plugin'
108

119
require_relative 'rubocop/cop/yard_cops'

lib/rubocop/yard/inject.rb

Lines changed: 0 additions & 20 deletions
This file was deleted.

lib/rubocop/yard/plugin.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# frozen_string_literal: true
2+
3+
require 'lint_roller'
4+
5+
module RuboCop
6+
module YARD
7+
# A plugin that integrates RuboCop Performance with RuboCop's plugin system.
8+
class Plugin < LintRoller::Plugin
9+
def about
10+
LintRoller::About.new(
11+
name: 'rubocop-yard',
12+
version: VERSION,
13+
homepage: 'https://github.com/ksss/rubocop-yard',
14+
description: 'Check yardoc format like tag type.'
15+
)
16+
end
17+
18+
def supported?(context)
19+
context.engine == :rubocop
20+
end
21+
22+
def rules(_context)
23+
LintRoller::Rules.new(
24+
type: :path,
25+
config_format: :rubocop,
26+
value: Pathname.new(__dir__).join('../../../config/default.yml')
27+
)
28+
end
29+
end
30+
end
31+
end

rubocop-yard.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
1818
spec.metadata["source_code_uri"] = spec.homepage
1919
spec.metadata["changelog_uri"] = spec.homepage
2020
spec.metadata['rubygems_mfa_required'] = 'true'
21+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::YARD::Plugin'
2122

2223
spec.files = Dir.chdir(File.expand_path(__dir__)) do
2324
[
@@ -31,7 +32,8 @@ Gem::Specification.new do |spec|
3132
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3233
spec.require_paths = ["lib"]
3334

34-
spec.add_runtime_dependency 'rubocop', "~> 1.21"
35+
spec.add_runtime_dependency 'lint_roller'
36+
spec.add_runtime_dependency 'rubocop', "~> 1.72"
3537
spec.add_runtime_dependency 'yard'
3638
end
3739

0 commit comments

Comments
 (0)