module Rails::Tc::Rubocop
Constants
- ACCESSOR_GROUPING_PATH
Public Class Methods
patch_configuration()
click to toggle source
# File lib/rails/tc/rubocop.rb, line 10 def self.patch_configuration rubocop_path = Rails.root.join(".rubocop.yml").to_s return unless File.exist?(rubocop_path) config = YAML.safe_load(File.read(rubocop_path)) raise InvalidConfigError.new("Invalid rubocop config") unless config.is_a?(Hash) modified = false if config.fetch(ACCESSOR_GROUPING_PATH, {}).fetch("Enabled", true) config[ACCESSOR_GROUPING_PATH] = { "Enabled" => false } modified = true end if modified File.open(rubocop_path, "w") { |f| f.write YAML.dump(config) } puts "Rubocop configuration patched" else puts "Rubocop configuration unchanged" end rescue puts "Unable to patch Rubocop configuration" end