-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR adds support for RuboCop's Plugin feature. Since RuboCop Rails still supports some older versions of RuboCop, a conditional check using `RuboCop.const_defined?(:Plugin)` has been added for compatibility. Once only versions of RuboCop that support the Plugin feature are supported, the compatibility code and the `RuboCop::Rails::Inject` module will be removed. This means that the legacy style will gradually become deprecated in the near future.
- Loading branch information
Showing
10 changed files
with
130 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#1434](https://github.com/rubocop/rubocop-rails/pull/1434): Pluginfy RuboCop Rails. ([@koic][]) |
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,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'lint_roller' | ||
|
||
module RuboCop | ||
module Rails | ||
# A plugin that integrates RuboCop Rails with RuboCop's plugin system. | ||
class Plugin < LintRoller::Plugin | ||
def about | ||
LintRoller::About.new( | ||
name: 'rubocop-rails', | ||
version: Version::STRING, | ||
homepage: 'https://github.com/rubocop/rubocop-rails', | ||
description: 'A RuboCop extension focused on enforcing Rails best practices and coding conventions.' | ||
) | ||
end | ||
|
||
def supported?(context) | ||
context.engine == :rubocop | ||
end | ||
|
||
def rules(_context) | ||
LintRoller::Rules.new( | ||
type: :path, | ||
config_format: :rubocop, | ||
value: Pathname.new(__dir__).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