From f30e99fdc0ca38955d2577080d05561e3e90600f Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Wed, 26 Oct 2022 22:22:24 -0400 Subject: [PATCH] Handle RuboCop constant name but rubocop file name --- lib/tapioca/dsl/compilers/{rubo_cop.rb => rubocop.rb} | 0 lib/tapioca/dsl/extensions/{rubo_cop.rb => rubocop.rb} | 0 .../dsl/compilers/{rubo_cop_spec.rb => rubocop_spec.rb} | 9 ++++++++- 3 files changed, 8 insertions(+), 1 deletion(-) rename lib/tapioca/dsl/compilers/{rubo_cop.rb => rubocop.rb} (100%) rename lib/tapioca/dsl/extensions/{rubo_cop.rb => rubocop.rb} (100%) rename spec/tapioca/dsl/compilers/{rubo_cop_spec.rb => rubocop_spec.rb} (95%) diff --git a/lib/tapioca/dsl/compilers/rubo_cop.rb b/lib/tapioca/dsl/compilers/rubocop.rb similarity index 100% rename from lib/tapioca/dsl/compilers/rubo_cop.rb rename to lib/tapioca/dsl/compilers/rubocop.rb diff --git a/lib/tapioca/dsl/extensions/rubo_cop.rb b/lib/tapioca/dsl/extensions/rubocop.rb similarity index 100% rename from lib/tapioca/dsl/extensions/rubo_cop.rb rename to lib/tapioca/dsl/extensions/rubocop.rb diff --git a/spec/tapioca/dsl/compilers/rubo_cop_spec.rb b/spec/tapioca/dsl/compilers/rubocop_spec.rb similarity index 95% rename from spec/tapioca/dsl/compilers/rubo_cop_spec.rb rename to spec/tapioca/dsl/compilers/rubocop_spec.rb index 82c35f760..7e97a747d 100644 --- a/spec/tapioca/dsl/compilers/rubo_cop_spec.rb +++ b/spec/tapioca/dsl/compilers/rubocop_spec.rb @@ -13,10 +13,17 @@ class RuboCopSpec < ::DslSpec .descendants_of(::RuboCop::Cop::Base) .filter_map { |constant| Runtime::Reflection.name_of(constant) } + class << self + def target_class_file + # Against convention, RuboCop uses "rubocop" in its file names, so we do too. + super.gsub("rubo_cop", "rubocop") + end + end + describe "Tapioca::Dsl::Compilers::RuboCop" do sig { void } def before_setup - require "tapioca/dsl/extensions/rubo_cop" + require "tapioca/dsl/extensions/rubocop" super end