Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error with cache and hydra arguments #779

Closed
josunect opened this issue Nov 15, 2022 · 2 comments · Fixed by #780
Closed

Runtime error with cache and hydra arguments #779

josunect opened this issue Nov 15, 2022 · 2 comments · Fixed by #780

Comments

@josunect
Copy link

I was interested in using the hydra argument to decrease the concurrency, as I think this is related to some punctual errors in the execution.

But, when running HTMLProofer with hydra or cache args, I'm getting a runtime error.

Parameters with hydra:

htmlproofer --hydra='{"max_concurrency": 10}' ./public

It results in:

/usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/configuration.rb:201:in `block (3 levels) in define_options': undefined local variable or method `arg' for #<HTMLProofer::Configuration:0x00007f8df038b488 @options={}> (NameError)

            @options[long_opt_symbol] = parse_json_option("hydra", arg, symbolize_names: false)
                                                                   ^^^
	from /usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/configuration.rb:253:in `block in set_option'
	from /usr/share/ruby/optparse.rb:1576:in `block in parse_in_order'
	from /usr/share/ruby/optparse.rb:1559:in `catch'
	from /usr/share/ruby/optparse.rb:1559:in `parse_in_order'
	from /usr/share/ruby/optparse.rb:1553:in `order!'
	from /usr/share/ruby/optparse.rb:1659:in `permute!'
	from /usr/share/ruby/optparse.rb:1684:in `parse!'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/configuration.rb:68:in `parse_cli_options'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/cli.rb:14:in `run'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/exe/htmlproofer:14:in `block in <top (required)>'
	from /usr/share/ruby/benchmark.rb:311:in `realtime'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/exe/htmlproofer:14:in `<top (required)>'
	from /usr/local/bin/htmlproofer:25:in `load'
	from /usr/local/bin/htmlproofer:25:in `<main>'

For cache:

htmlproofer --cache='{"timeframe": {"external": "20d"}}' ./public

Result:

gems/html-proofer-5.0.1/lib/html_proofer/configuration.rb:205:in `block (3 levels) in define_options': undefined local variable or method `arg' for #<HTMLProofer::Configuration:0x00007f0edd42b650 @options={}> (NameError)

            @options[long_opt_symbol] = parse_json_option("cache", arg, symbolize_names: false)
                                                                   ^^^
	from /usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/configuration.rb:253:in `block in set_option'
	from /usr/share/ruby/optparse.rb:1576:in `block in parse_in_order'
	from /usr/share/ruby/optparse.rb:1559:in `catch'
	from /usr/share/ruby/optparse.rb:1559:in `parse_in_order'
	from /usr/share/ruby/optparse.rb:1553:in `order!'
	from /usr/share/ruby/optparse.rb:1659:in `permute!'
	from /usr/share/ruby/optparse.rb:1684:in `parse!'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/configuration.rb:68:in `parse_cli_options'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/lib/html_proofer/cli.rb:14:in `run'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/exe/htmlproofer:14:in `block in <top (required)>'
	from /usr/share/ruby/benchmark.rb:311:in `realtime'
	from /usr/local/share/gems/gems/html-proofer-5.0.1/exe/htmlproofer:14:in `<top (required)>'
	from /usr/local/bin/htmlproofer:25:in `load'
	from /usr/local/bin/htmlproofer:25:in `<main>'

typhoeus seems to be working fine:

htmlproofer --typhoeus '{"connecttimeout": 30, "timeout": 30}' ./public

Results:

Checking 411 external links
Checking 562 internal links
Checking internal link hashes in 0 files
Ran on 103 files!


HTML-Proofer finished successfully.
Finished in 10.98 seconds

Environment

  • htmlproofer 5.0.1
  • typhoeus 1.4.0
  • ruby 3.1.2
@gjtorikian
Copy link
Owner

Oof, thanks for reporting this. It was a deadly combination of a typo, and a test suite that was not correct.

@josunect
Copy link
Author

Oof, thanks for reporting this. It was a deadly combination of a typo, and a test suite that was not correct.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants