-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Validate options #767
Validate options #767
Conversation
2f9f7d2
to
53ad902
Compare
private | ||
|
||
def default_options | ||
PROOFER_DEFAULTS.merge(typhoeus: TYPHOEUS_DEFAULTS).merge(hydra: HYDRA_DEFAULTS).merge(parallel: PARALLEL_DEFAULTS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not feel like an elegant or bullet-proof way to enumerate all existing options to extract their default value type. Suggestions for how to improve this would be appreciated.
53ad902
to
405e06c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that I've managed to add the file spec/html-proofer/fixtures/links/erstiebegrüßung.html
in this PR. I have major issues with that file on macOS 11.7. I've attempted to do everything mentioned in this post, but the file is still deleted and re-added at random and makes other Git operations such as rebase, impossible.
Validate options on initialization so more user friendly and descriptive errors are thrown when options have invalid values.
0afe938
to
12a9409
Compare
As #772 is merged, this PR has now been rebased on |
Thanks! I'm going to release this as a 4.x bug fix for this and then work more on V5 (#759) this weekend. |
@@ -25,22 +25,22 @@ def check_file(file, options = {}) | |||
raise ArgumentError unless file.is_a?(String) | |||
raise ArgumentError, "#{file} does not exist" unless File.exist?(file) | |||
|
|||
options[:type] = :file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.is_a?(Hash)+ ({yes}))
If you, for instance, pass
assume_extension: true
to HTMLProofer now, it is going to fail with the following error:This error is a bit hard to decipher since it is not pointed to the fact that the problem stems from an invalid type being passed in
options
and it also doesn't say which option key is problematic. This PR adds validation of options on initialization so more user-friendly and descriptive errors are thrown when options have invalid values.