hiroaki514 / contents_management_app

0 stars 0 forks source link

erbのlintを追加する #141

Closed yoshichiba closed 1 year ago

yoshichiba commented 1 year ago

https://zenn.dev/junara/articles/efa04ce1ab02c9

hiroaki514 commented 1 year ago
$ docker compose run web erblint --lint-all -a
 Container contents_management_app-db-1  Running
Linting and autocorrecting 25 files with 15 linters (12 autocorrectable)...
Exception occurred when processing: app/views/admin/index.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 465 is out of range for document of size 453
/usr/local/bundle/gems/better_html-2.0.2/lib/better_html/tokenizer/location.rb:14:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `to_source_range'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:20:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linter.rb:59:in `run_and_update_offense_status'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:28:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:161:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

Exception occurred when processing: app/views/admin/new.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 1292 is out of range for document of size 1265
/usr/local/bundle/gems/better_html-2.0.2/lib/better_html/tokenizer/location.rb:14:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `to_source_range'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:20:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linter.rb:59:in `run_and_update_offense_status'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:28:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:161:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

Exception occurred when processing: app/views/general/index.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 603 is out of range for document of size 577
/usr/local/bundle/gems/better_html-2.0.2/lib/better_html/tokenizer/location.rb:14:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `to_source_range'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:20:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linter.rb:59:in `run_and_update_offense_status'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:28:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:161:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

Exception occurred when processing: app/views/layouts/_header.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 4398 is out of range for document of size 4391
/usr/local/bundle/gems/better_html-2.0.2/lib/better_html/tokenizer/location.rb:14:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `to_source_range'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:20:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linter.rb:59:in `run_and_update_offense_status'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:28:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:161:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

Exception occurred when processing: app/views/master/index.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 464 is out of range for document of size 451
/usr/local/bundle/gems/better_html-2.0.2/lib/better_html/tokenizer/location.rb:14:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `to_source_range'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:20:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linter.rb:59:in `run_and_update_offense_status'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:28:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:161:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

Exception occurred when processing: app/views/master/new.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 1447 is out of range for document of size 1444
/usr/local/bundle/gems/better_html-2.0.2/lib/better_html/tokenizer/location.rb:14:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/processed_source.rb:27:in `to_source_range'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:20:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:14:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linter.rb:59:in `run_and_update_offense_status'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:28:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/runner.rb:27:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:161:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

Exception occurred when processing: app/views/master/show.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
The range 82...83 is outside the bounds of the source
/usr/local/bundle/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:406:in `check_range_validity'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/corrector.rb:120:in `check_range_validity'
/usr/local/bundle/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:398:in `combine'
/usr/local/bundle/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:194:in `replace'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/linters/trailing_whitespace.rb:28:in `block in autocorrect'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrections_proxy.rb:14:in `block (2 levels) in <<'
/usr/local/bundle/gems/parser-3.2.2.3/lib/parser/source/tree_rewriter.rb:319:in `transaction'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrections_proxy.rb:14:in `block in <<'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrections_proxy.rb:36:in `suppress_clobbering'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrections_proxy.rb:14:in `<<'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrector.rb:16:in `block in initialize'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrector.rb:16:in `each'
/usr/local/bundle/gems/rubocop-1.54.0/lib/rubocop/cop/legacy/corrector.rb:16:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/corrector.rb:20:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/corrector.rb:20:in `corrector'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/corrector.rb:10:in `initialize'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:205:in `new'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:205:in `correct'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:164:in `block in run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `times'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:159:in `run_with_corrections'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:130:in `run_on_file'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:86:in `block in run'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `each'
/usr/local/bundle/gems/erb_lint-0.4.0/lib/erb_lint/cli.rb:83:in `run'
/usr/local/bundle/gems/erb_lint-0.4.0/exe/erblint:9:in `<top (required)>'
/usr/local/bundle/bin/erblint:25:in `load'
/usr/local/bundle/bin/erblint:25:in `<main>'

No errors were found in ERB files
yoshichiba commented 1 year ago

ビューファイルがうまく読み込めていないようです。

Linting and autocorrecting 25 files with 15 linters (12 autocorrectable)...
Exception occurred when processing: app/views/admin/index.html.erb
If this file cannot be processed by erb-lint, you can exclude it in your configuration file.
begin_pos location 465 is out of range for document of size 453
mpg-yoshiharu-chiba commented 1 year ago

エラーの原因は謎ですが、そもそもインデントは整えてくれなそうでした、、、 実際に手元でも動かしてみましたが、想像したことはできなそうですねmm https://techtechmedia.com/erb-lint-rails/

yoshichiba commented 1 year ago

erb-lintは外す方向で行きますmm