Skip to content

Commit

Permalink
Rename instances of erb-lint to erb_lint
Browse files Browse the repository at this point in the history
  • Loading branch information
george-ma committed Jul 22, 2024
1 parent 7fee94b commit 3ff8ad5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
---
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
---
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: erb-lint
name: erb_lint

up:
- ruby
Expand Down
2 changes: 1 addition & 1 deletion erb_lint.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.email = ["[email protected]"]
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/*"]
Expand Down
2 changes: 1 addition & 1 deletion lib/erb_lint/runner_config_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
6 changes: 3 additions & 3 deletions spec/erb_lint/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions spec/erb_lint/runner_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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),
Expand All @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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",
},
)

Expand Down

0 comments on commit 3ff8ad5

Please sign in to comment.