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

Improve documentation suggestion for ConditionalUsingTest #841

Open
gravitystorm opened this issue Mar 29, 2021 · 0 comments
Open

Improve documentation suggestion for ConditionalUsingTest #841

gravitystorm opened this issue Mar 29, 2021 · 0 comments

Comments

@gravitystorm
Copy link

The documentation for ConditionalUsingTest currently reads as:

Use ::File.exist?('/foo/bar') instead of the slower 'test -f /foo/bar' which requires shelling out

However, it doesn't mention that the ruby code should be passed as a block. If you're like me and read the suggestion as-is, you might write:

...
not_if ::File.exist?('/foo/bar')
...

... which will then throw an error ArgumentError: Invalid only_if/not_if command, expected a string: true (TrueClass) if the file exists. Passing as a block:

...
not_if { ::File.exist?('/foo/bar') }
...

... is the intention of the cop.

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

No branches or pull requests

1 participant