From 3ff8ad5ca8c7a08dbd093785a411db96a96221af Mon Sep 17 00:00:00 2001 From: George Ma Date: Mon, 22 Jul 2024 11:56:42 -0400 Subject: [PATCH] Rename instances of erb-lint to erb_lint --- README.md | 20 ++++++++++---------- dev.yml | 2 +- erb_lint.gemspec | 2 +- lib/erb_lint/runner_config_resolver.rb | 2 +- spec/erb_lint/cli_spec.rb | 6 +++--- spec/erb_lint/runner_config_spec.rb | 12 ++++++------ 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1936ce7b..b9f4711e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ERB Lint [![Build Status](https://github.com/Shopify/erb-lint/workflows/Tests/badge.svg)](https://github.com/Shopify/erb-lint/actions) +# ERB Lint [![Build Status](https://github.com/Shopify/erb_lint/workflows/Tests/badge.svg)](https://github.com/Shopify/erb_lint/actions) -`erb-lint` is a tool to help lint your ERB or HTML files using the included linters or by writing your own. +`erb_lint` is a tool to help lint your ERB or HTML files using the included linters or by writing your own. ## Requirements @@ -22,7 +22,7 @@ gem 'erb_lint', require: false ## Configuration -Create a `.erb-lint.yml` file in your project, with the following structure: +Create a `.erb_lint.yml` file in your project, with the following structure: ```yaml --- @@ -221,8 +221,8 @@ Linter-Specific Option | Description ### Rubocop -Runs RuboCop on all ruby statements found in ERB templates. The RuboCop configuration that `erb-lint` uses can inherit from -the configuration that the rest of your application uses. `erb-lint` can be configured independently however, as it will often +Runs RuboCop on all ruby statements found in ERB templates. The RuboCop configuration that `erb_lint` uses can inherit from +the configuration that the rest of your application uses. `erb_lint` can be configured independently however, as it will often be necessary to disable specific RuboCop rules that do not apply to ERB files. **Note**: Each ruby statement (between ERB tags `<% ... %>`) is parsed and analyzed independently of each other. Any rule that requires a broader context can trigger false positives (e.g. `Lint/UselessAssignment` will complaint for an assignment even if used in a subsequent ERB tag). @@ -523,7 +523,7 @@ Good ✅ ## Custom Linters -`erb-lint` allows you to create custom linters specific to your project. It will load linters from the `.erb-linters` directory in the root of your +`erb_lint` allows you to create custom linters specific to your project. It will load linters from the `.erb-linters` directory in the root of your repository. See the [linters directory](lib/erb_lint/linters) for examples of how to write linters. ```ruby @@ -552,7 +552,7 @@ module ERBLint end ``` -By default, this linter would be disabled. You can enable it by adding an entry to `.erb-lint.yml`: +By default, this linter would be disabled. You can enable it by adding an entry to `.erb_lint.yml`: ```yaml --- @@ -582,7 +582,7 @@ Errors were found in ERB files To write a linter that can autocorrect offenses it detects, simply add an `autocorrect` method that returns a callable. The callable is called with an instance of [`RuboCop::Cop::Corrector`](http://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Corrector) -as argument, and therefore erb-lint correctors work exactly as RuboCop correctors do. +as argument, and therefore erb_lint correctors work exactly as RuboCop correctors do. ```ruby def autocorrect(_processed_source, offense) @@ -693,9 +693,9 @@ No errors were found in ERB files ``` Cached lint results are stored in the `.erb-lint-cache` directory by default, though a custom directory can be provided -via the `--cache-dir` option. Cache filenames are computed with a hash of information about the file and `erb-lint` settings. +via the `--cache-dir` option. Cache filenames are computed with a hash of information about the file and `erb_lint` settings. These files store instance attributes of the `CachedOffense` object, which only contain the `Offense` attributes -necessary to restore the results of running `erb-lint` for output. The cache also automatically prunes outdated files each time it's run. +necessary to restore the results of running `erb_lint` for output. The cache also automatically prunes outdated files each time it's run. You can also use the `--clear-cache` option to delete the cache file directory. diff --git a/dev.yml b/dev.yml index 003f5bac..711dad02 100644 --- a/dev.yml +++ b/dev.yml @@ -1,4 +1,4 @@ -name: erb-lint +name: erb_lint up: - ruby diff --git a/erb_lint.gemspec b/erb_lint.gemspec index 33bab62a..6e6de6f6 100644 --- a/erb_lint.gemspec +++ b/erb_lint.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.email = ["ruby@shopify.com"] s.summary = "ERB lint tool" s.description = "ERB Linter tool." - s.homepage = "https://github.com/Shopify/erb-lint" + s.homepage = "https://github.com/Shopify/erb_lint" s.license = "MIT" s.files = Dir["lib/**/*.rb", "exe/*"] diff --git a/lib/erb_lint/runner_config_resolver.rb b/lib/erb_lint/runner_config_resolver.rb index 93748664..289a9d31 100644 --- a/lib/erb_lint/runner_config_resolver.rb +++ b/lib/erb_lint/runner_config_resolver.rb @@ -37,7 +37,7 @@ def resolve_inheritance(hash, file_loader) def resolve_inheritance_from_gems(hash, gems) (gems || {}).each_pair do |gem_name, config_path| - raise(ArgumentError, "can't inherit configuration from the erb-lint gem") if gem_name == "erb-lint" + raise(ArgumentError, "can't inherit configuration from the erb_lint gem") if gem_name == "erb_lint" hash["inherit_from"] = Array(hash["inherit_from"]) Array(config_path).reverse_each do |path| diff --git a/spec/erb_lint/cli_spec.rb b/spec/erb_lint/cli_spec.rb index 4d9c680c..767641c1 100644 --- a/spec/erb_lint/cli_spec.rb +++ b/spec/erb_lint/cli_spec.rb @@ -227,7 +227,7 @@ def run(processed_source) context "without --config" do context "when default config does not exist" do - it { expect { subject }.to(output(/\.erb-lint\.yml not found: using default config/).to_stderr) } + it { expect { subject }.to(output(/\.erb_lint\.yml not found: using default config/).to_stderr) } end end @@ -444,7 +444,7 @@ def run(processed_source) context "without --config" do context "when default config does not exist" do - it { expect { subject }.to(output(/\.erb-lint\.yml not found: using default config/).to_stderr) } + it { expect { subject }.to(output(/\.erb_lint\.yml not found: using default config/).to_stderr) } end end @@ -603,7 +603,7 @@ def run(processed_source) context "without --config" do context "when default config does not exist" do - it { expect { subject }.to(output(/\.erb-lint\.yml not found: using default config/).to_stderr) } + it { expect { subject }.to(output(/\.erb_lint\.yml not found: using default config/).to_stderr) } end end diff --git a/spec/erb_lint/runner_config_spec.rb b/spec/erb_lint/runner_config_spec.rb index 91bba348..684f42b1 100644 --- a/spec/erb_lint/runner_config_spec.rb +++ b/spec/erb_lint/runner_config_spec.rb @@ -223,7 +223,7 @@ class MySchema < ERBLint::LinterConfig after { FileUtils.rm_rf(tmp_root) } it "inherits from a gem and loads the config" do - create_file("#{gem_root}/gemone/config/erb-lint.yml", <<-YAML.strip_indent) + create_file("#{gem_root}/gemone/config/erb_lint.yml", <<-YAML.strip_indent) MyCustomLinter: my_option: custom value YAML @@ -238,7 +238,7 @@ class MySchema < ERBLint::LinterConfig runner_config = described_class.new( { "inherit_gem" => { - "gemone" => "config/erb-lint.yml", + "gemone" => "config/erb_lint.yml", }, }, ERBLint::FileLoader.new(Dir.pwd), @@ -248,7 +248,7 @@ class MySchema < ERBLint::LinterConfig end it "inherits from a gem and merges the config" do - create_file("#{gem_root}/gemone/config/erb-lint.yml", <<-YAML.strip_indent) + create_file("#{gem_root}/gemone/config/erb_lint.yml", <<-YAML.strip_indent) MyCustomLinter1: a: value to be overwritten b: value for b @@ -264,7 +264,7 @@ class MySchema < ERBLint::LinterConfig runner_config = described_class.new( { "inherit_gem" => { - "gemone" => "config/erb-lint.yml", + "gemone" => "config/erb_lint.yml", }, "MyCustomLinter1" => { "a" => "value for a", @@ -332,7 +332,7 @@ class MySchema < ERBLint::LinterConfig end it "inherits from a gem if file load is not provided" do - create_file("#{gem_root}/gemone/config/erb-lint.yml", <<-YAML.strip_indent) + create_file("#{gem_root}/gemone/config/erb_lint.yml", <<-YAML.strip_indent) MyCustomLinter: my_option: custom value YAML @@ -346,7 +346,7 @@ class MySchema < ERBLint::LinterConfig runner_config = described_class.new( "inherit_gem" => { - "gemone" => "config/erb-lint.yml", + "gemone" => "config/erb_lint.yml", }, )