Skip to content
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

4 more rubocop fixes #852

Merged
merged 4 commits into from
Feb 19, 2018
Merged

4 more rubocop fixes #852

merged 4 commits into from
Feb 19, 2018

Conversation

alexjfisher
Copy link
Member

No description provided.

@@ -78,7 +78,8 @@ def self.get_job(job, catalog = nil)
# currently unused
def self.job_enabled(job, catalog = nil)
raw = clihelper(['job_enabled', job], catalog: catalog)
!!(raw =~ %r{true})
return true if raw =~ %r{true}
false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's probably a better way that still doesn't use !!. Open to suggestions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://stackoverflow.com/a/41707707 suggests raw =~ %r{true} ? true : false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the concern here? The meaning of !! is non-ambiguous.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhoblitt I don't disagree, and others also share your view. eg See rubocop/ruby-style-guide#591

Meanwhile, I think @ekohl's suggestion is less ugly than using a control comment.

!!(raw =~ %r{true}) # rubocop:disable Style/DoubleNegation

I've been trying to get rid of .rubocop_todo.yml so that we can finally do the modulesync required for us to be able to release using the normal Vox Pupuli process. With this PR we're down to 'just' 196 violations having originally started at more than 3000. We probably will end up using some control comments to disable certain cops, but I've been trying to resist so far.

@bastelfreak bastelfreak merged commit a55717d into voxpupuli:master Feb 19, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants