I run hamlcop to the following haml.
It has a valid syntax, but hamli failed to parse it.
-# dummy.haml
- [].each do |n|
%p
hi
%span
$ haml -v
Haml 5.2.2
$ haml -c dummy.haml
Syntax OK
$ hamlcop -v
hamlcop 0.2.2
$ hamlcop dummy.haml
Inspecting 1 file
bundler: failed to load command: hamlcop (/Users/tricknotes/.rbenv/versions/3.1.0/bin/hamlcop)
/Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamli-0.5.0/lib/hamli/parser.rb:481:in `syntax_error!': MalformedIndentationError at hoge.html.haml:4:3 (Hamli::Errors::MalformedIndentationError)
%span
^
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamli-0.5.0/lib/hamli/parser.rb:96:in `parse_indent'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamli-0.5.0/lib/hamli/parser.rb:31:in `parse_block'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamli-0.5.0/lib/hamli/parser.rb:22:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamlcop-0.1.0/lib/hamlcop/ruby_extractor.rb:46:in `ast'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamlcop-0.1.0/lib/hamlcop/ruby_extractor.rb:53:in `ranges'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamlcop-0.1.0/lib/hamlcop/ruby_extractor.rb:32:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamlcop-0.1.0/lib/hamlcop/ruby_extractor.rb:19:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/template_offense_collector.rb:48:in `snippets'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/template_offense_collector.rb:27:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/runner.rb:64:in `investigate'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/runner.rb:74:in `block (2 levels) in run_in_parallel'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/runner.rb:71:in `times'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/runner.rb:71:in `block in run_in_parallel'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:515:in `call_with_index'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:485:in `process_incoming_jobs'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:465:in `block in worker'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:456:in `fork'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:456:in `worker'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:447:in `block in create_workers'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:446:in `each'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:446:in `each_with_index'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:446:in `create_workers'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:386:in `work_in_processes'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/parallel-1.21.0/lib/parallel.rb:289:in `map'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/runner.rb:69:in `run_in_parallel'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/runner.rb:31:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/cli.rb:77:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/templatecop-0.2.2/lib/templatecop/cli.rb:38:in `call'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/hamlcop-0.1.0/exe/hamlcop:8:in `<top (required)>'
from /Users/tricknotes/.rbenv/versions/3.1.0/bin/hamlcop:25:in `load'
from /Users/tricknotes/.rbenv/versions/3.1.0/bin/hamlcop:25:in `<top (required)>'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:58:in `load'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli/exec.rb:23:in `run'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli.rb:484:in `exec'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli.rb:31:in `dispatch'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/cli.rb:25:in `start'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/exe/bundle:48:in `block in <top (required)>'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /Users/tricknotes/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.4/exe/bundle:36:in `<top (required)>'
from /Users/tricknotes/.rbenv/versions/3.1.0/bin/bundle:25:in `load'
from /Users/tricknotes/.rbenv/versions/3.1.0/bin/bundle:25:in `<main>'
I run hamlcop to the following haml. It has a valid syntax, but hamli failed to parse it.