Skip to content

Commit

Permalink
Inform RuboCop about loaded extensions (#150)
Browse files Browse the repository at this point in the history
Loading a rubocop extension is nothing but requiring a library, but
rubocop likes to know what's loaded
so it can suggest you extensions that are loaded but not used.


https://github.com/rubocop/rubocop/blob/02c32b4cf3801f9cf4cca4b3f1f4288aaee2ad5c/lib/rubocop/options.rb#L304
  • Loading branch information
xjunior authored Jul 13, 2023
1 parent 6e2d919 commit d676680
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/rubocop-powerhome/lib/rubocop-powerhome.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# frozen_string_literal: true

require "rubocop"
require "rubocop-performance"
require "rubocop-rails"
require "rubocop-rake"
require "rubocop-rspec"

require_relative "rubocop/powerhome"

RuboCop::Powerhome::Inject.defaults!

require_relative "rubocop/cop/naming_cops"
require_relative "rubocop/cop/style_cops"

def load_rubocop_extension(extension)
RuboCop::ConfigLoader.add_loaded_features(extension)
require extension
end

load_rubocop_extension "rubocop-performance"
load_rubocop_extension "rubocop-rails"
load_rubocop_extension "rubocop-rake"
load_rubocop_extension "rubocop-rspec"

RuboCop::Powerhome::Inject.defaults!

0 comments on commit d676680

Please sign in to comment.