-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make RuboCop RSpecRails work as a RuboCop plugin
This pull request adds support for RuboCop's plugin feature, added in rubocop/rubocop#13792, released in v1.72. It replaces the ad-hoc `inject_defaults!` with RuboCop plugins. Some Rake tasks may still need to use `inject_defaults!`.
- Loading branch information
Showing
10 changed files
with
61 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'lint_roller' | ||
|
||
module RuboCop | ||
module RSpecRails | ||
# A plugin that integrates RuboCop RSpecRails with RuboCop's plugin system. | ||
class Plugin < LintRoller::Plugin | ||
# :nocov: | ||
def about | ||
LintRoller::About.new( | ||
name: 'rubocop-rspec_rails', | ||
version: Version::STRING, | ||
homepage: 'https://github.com/rubocop/rubocop-rspec_rails', | ||
description: 'Code style checking for RSpec Rails files.' | ||
) | ||
end | ||
# :nocov: | ||
|
||
def supported?(context) | ||
context.engine == :rubocop | ||
end | ||
|
||
def rules(_context) | ||
project_root = Pathname.new(__dir__).join('../../..') | ||
|
||
LintRoller::Rules.new( | ||
type: :path, | ||
config_format: :rubocop, | ||
value: project_root.join('config/default.yml') | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters