-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate Ruby (
rubocop-github
) from Rails (rubocop-github-rails
) …
…cops and rules to disambiguate rule inheritance from custom cops
- Loading branch information
1 parent
fe136a1
commit 6945049
Showing
12 changed files
with
165 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
inherit_from: ./config/default.yml | ||
inherit_from: | ||
- ./config/default.yml | ||
|
||
Naming/FileName: | ||
Enabled: true | ||
Exclude: | ||
- "rubocop-github.gemspec" | ||
- "lib/rubocop-github.rb" | ||
- "lib/rubocop-github-rails.rb" |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require: | ||
- rubocop/cop/github | ||
- rubocop-github | ||
- rubocop-performance | ||
|
||
AllCops: | ||
|
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,3 @@ | ||
GitHub/InsecureHashAlgorithm: | ||
Description: 'Encourage usage of secure hash algorithms' | ||
Enabled: pending |
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,62 @@ | ||
GitHub/RailsApplicationRecord: | ||
Enabled: pending | ||
|
||
GitHub/RailsControllerRenderActionSymbol: | ||
Enabled: pending | ||
Include: | ||
- 'app/controllers/**/*.rb' | ||
|
||
GitHub/RailsControllerRenderLiteral: | ||
Enabled: pending | ||
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md | ||
Include: | ||
- 'app/controllers/**/*.rb' | ||
|
||
GitHub/RailsControllerRenderPathsExist: | ||
Enabled: pending | ||
ViewPath: | ||
- 'app/views' | ||
Include: | ||
- 'app/controllers/**/*.rb' | ||
|
||
GitHub/RailsControllerRenderShorthand: | ||
Enabled: pending | ||
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-shorthand.md | ||
Include: | ||
- 'app/controllers/**/*.rb' | ||
|
||
GitHub/RailsRenderInline: | ||
Enabled: pending | ||
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-inline.md | ||
Include: | ||
- 'app/controllers/**/*.rb' | ||
- 'app/helpers/**/*.rb' | ||
- 'app/view_models/**/*.rb' | ||
- 'app/views/**/*.erb' | ||
|
||
GitHub/RailsRenderObjectCollection: | ||
Enabled: pending | ||
|
||
GitHub/RailsViewRenderLiteral: | ||
Enabled: pending | ||
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md | ||
Include: | ||
- 'app/helpers/**/*.rb' | ||
- 'app/view_models/**/*.rb' | ||
- 'app/views/**/*.erb' | ||
|
||
GitHub/RailsViewRenderPathsExist: | ||
Enabled: pending | ||
ViewPath: | ||
- 'app/views' | ||
Include: | ||
- 'app/helpers/**/*.rb' | ||
- 'app/view_models/**/*.rb' | ||
- 'app/views/**/*.erb' | ||
|
||
GitHub/RailsViewRenderShorthand: | ||
Enabled: pending | ||
Include: | ||
- 'app/helpers/**/*.rb' | ||
- 'app/view_models/**/*.rb' | ||
- 'app/views/**/*.erb' |
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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rubocop" | ||
require "rubocop/github" | ||
require "rubocop/github/inject" | ||
|
||
RuboCop::GitHub::Inject.rails_defaults! | ||
|
||
require "rubocop/cop/github/rails_application_record" | ||
require "rubocop/cop/github/rails_controller_render_action_symbol" | ||
require "rubocop/cop/github/rails_controller_render_literal" | ||
require "rubocop/cop/github/rails_controller_render_paths_exist" | ||
require "rubocop/cop/github/rails_controller_render_shorthand" | ||
require "rubocop/cop/github/rails_render_inline" | ||
require "rubocop/cop/github/rails_render_object_collection" | ||
require "rubocop/cop/github/rails_view_render_literal" | ||
require "rubocop/cop/github/rails_view_render_paths_exist" | ||
require "rubocop/cop/github/rails_view_render_shorthand" |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rubocop" | ||
require "rubocop/github" | ||
require "rubocop/github/inject" | ||
|
||
RuboCop::GitHub::Inject.default_defaults! | ||
|
||
require "rubocop/cop/github/insecure_hash_algorithm" |
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 |
---|---|---|
@@ -1,13 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rubocop/cop/github/insecure_hash_algorithm" | ||
require "rubocop/cop/github/rails_application_record" | ||
require "rubocop/cop/github/rails_controller_render_action_symbol" | ||
require "rubocop/cop/github/rails_controller_render_literal" | ||
require "rubocop/cop/github/rails_controller_render_paths_exist" | ||
require "rubocop/cop/github/rails_controller_render_shorthand" | ||
require "rubocop/cop/github/rails_render_inline" | ||
require "rubocop/cop/github/rails_render_object_collection" | ||
require "rubocop/cop/github/rails_view_render_literal" | ||
require "rubocop/cop/github/rails_view_render_paths_exist" | ||
require "rubocop/cop/github/rails_view_render_shorthand" | ||
require "rubocop-github" | ||
require "rubocop-rails" |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module RuboCop | ||
module GitHub | ||
PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze | ||
CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default_cops.yml").freeze | ||
CONFIG_RAILS = PROJECT_ROOT.join("config", "rails_cops.yml").freeze | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module RuboCop | ||
module GitHub | ||
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a | ||
# bit of our configuration. Borrowed from: | ||
# https://github.com/rubocop/rubocop-rails/blob/f36121946359615a26c9a941763abd1470693e8d/lib/rubocop/rails/inject.rb | ||
module Inject | ||
def self.default_defaults! | ||
_load_config(CONFIG_DEFAULT) | ||
end | ||
|
||
def self.rails_defaults! | ||
_load_config(CONFIG_RAILS) | ||
end | ||
|
||
def self._load_config(path) | ||
path = path.to_s | ||
hash = ConfigLoader.send(:load_yaml_configuration, path) | ||
config = Config.new(hash, path).tap(&:make_excludes_absolute) | ||
puts "configuration from #{path}" if ConfigLoader.debug? | ||
config = ConfigLoader.merge_with_default(config, path, unset_nil: false) | ||
ConfigLoader.instance_variable_set(:@default_configuration, config) | ||
end | ||
end | ||
end | ||
end |