-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add an option to override ignore private apis #28
base: master
Are you sure you want to change the base?
Conversation
@@ -1,5 +1,8 @@ | |||
PuppetLint.new_check(:parameter_documentation) do | |||
def check | |||
|
|||
ignore_private = PuppetLint.configuration.docs_ignore_private_api.nil? ? true : PuppetLint.configuration.docs_ignore_private_api |
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 looked into a cleaner way to add configuration but it looks like there isn't really a good way. Perhaps it can be simplified to
ignore_private = PuppetLint.configuration.docs_ignore_private_api.nil? ? true : PuppetLint.configuration.docs_ignore_private_api | |
ignore_private = PuppetLint.configuration.docs_ignore_private_api.nil? || PuppetLint.configuration.docs_ignore_private_api |
Not sure if it's cleaner. The cleanest way would be to have an API to also add a default.
Perhaps a much better way is to avoid the negative name and name it docs_check_private_params
. That can default to false
. Since nil
and false
are equivalent in this case, it would solve the problem.
The only downside is that the unless
condition becomes more complex, but overall I think it's a win. Let me know what you think.
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 have no opinion on the naming. adjustments have been made :)
89a8f96
to
53e2f92
Compare
53e2f92
to
cb3a376
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.
Small nits, otherwise 👍
@@ -1,5 +1,7 @@ | |||
PuppetLint.new_check(:parameter_documentation) do | |||
def check | |||
check_private = PuppetLint.configuration.docs_check_private_params || false |
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.
nil
and false
evaluate to the same
check_private = PuppetLint.configuration.docs_check_private_params || false | |
check_private = PuppetLint.configuration.docs_check_private_params |
@@ -50,7 +52,7 @@ def check | |||
} | |||
end | |||
|
|||
unless is_private | |||
unless is_private and not check_private |
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.
Ruby uses &&
instead of and
(same for ||
vs or
)
unless is_private and not check_private | |
unless is_private && !check_private |
No description provided.