From d8523d9a9f96f9dbf39b9f12780427106354b2f2 Mon Sep 17 00:00:00 2001 From: George Ma Date: Tue, 23 Jul 2024 11:19:47 -0400 Subject: [PATCH] Deprecate `erb-lint` mentions in the Cli to `erb_lint` --- lib/erb_lint/cli.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/erb_lint/cli.rb b/lib/erb_lint/cli.rb index 3e6a6b0..b86e15d 100644 --- a/lib/erb_lint/cli.rb +++ b/lib/erb_lint/cli.rb @@ -13,7 +13,8 @@ module ERBLint class CLI include Utils::SeverityLevels - DEFAULT_CONFIG_FILENAME = ".erb-lint.yml" + DEPRECATED_CONFIG_FILENAME = ".erb-lint.yml" + DEFAULT_CONFIG_FILENAME = ".erb_lint.yml" DEFAULT_LINT_ALL_GLOB = "**/*.html{+*,}.erb" class ExitWithFailure < RuntimeError; end @@ -87,7 +88,7 @@ def run(args = ARGV) rescue => e @stats.exceptions += 1 puts "Exception occurred when processing: #{relative_filename(filename)}" - puts "If this file cannot be processed by erb-lint, " \ + puts "If this file cannot be processed by erb_lint, " \ "you can exclude it in your configuration file." puts e.message puts Rainbow(e.backtrace.join("\n")).red @@ -215,6 +216,10 @@ def load_config if File.exist?(config_filename) config = RunnerConfig.new(file_loader.yaml(config_filename), file_loader) @config = RunnerConfig.default_for(config) + elsif File.exist?(DEPRECATED_CONFIG_FILENAME) + warn(Rainbow("#{DEPRECATED_CONFIG_FILENAME} is soon deprecated. Rename your config to erb_lint.yml.").yellow) + config = RunnerConfig.new(file_loader.yaml(DEPRECATED_CONFIG_FILENAME), file_loader) + @config = RunnerConfig.default_for(config) else warn(Rainbow("#{config_filename} not found: using default config").yellow) @config = RunnerConfig.default