Skip to content

Commit 7890ce7

Browse files
committed
Convert to plugin system
1 parent 2283162 commit 7890ce7

5 files changed

Lines changed: 33 additions & 19 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ gem install rubocop-chromebrew
1111
## Usage
1212

1313
```
14-
rubocop --require rubocop-chromebrew
14+
rubocop --plugin rubocop-chromebrew
1515
```

lib/rubocop-chromebrew.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
require 'rubocop'
22

33
require_relative 'rubocop/chromebrew'
4-
require_relative 'rubocop/chromebrew/inject'
5-
6-
RuboCop::Chromebrew::Inject.defaults!
4+
require_relative 'rubocop/chromebrew/plugin'
75

86
require_relative 'rubocop/cop/chromebrew_cops'

lib/rubocop/chromebrew/inject.rb

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

lib/rubocop/chromebrew/plugin.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'lint_roller'
2+
3+
module RuboCop
4+
module Chromebrew
5+
class Plugin < LintRoller::Plugin
6+
def about
7+
LintRoller::About.new(
8+
name: 'rubocop-chromebrew',
9+
version: '0.0.4',
10+
homepage: 'https://github.com/chromebrew/rubocop-chromebrew',
11+
description: 'A RuboCop extension for Chromebrew-specific practices.'
12+
)
13+
end
14+
15+
def supported?(context)
16+
context.engine == :rubocop
17+
end
18+
19+
def rules(_context)
20+
LintRoller::Rules.new(
21+
type: :path,
22+
config_format: :rubocop,
23+
value: Pathname.new(__dir__).join('../../../config/default.yml')
24+
)
25+
end
26+
end
27+
end
28+
end

rubocop-chromebrew.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ Gem::Specification.new do |spec|
77
spec.email = 'creatorsmithmdt@gmail.com'
88
spec.homepage = 'https://github.com/chromebrew/rubocop-chromebrew'
99

10+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::Chromebrew::Plugin'
11+
1012
spec.files = `git ls-files`.split("\n")
1113
spec.require_paths = ['lib']
1214

15+
spec.add_dependency 'lint_roller'
1316
spec.add_runtime_dependency 'rubocop'
1417
end

0 commit comments

Comments
 (0)