-
Notifications
You must be signed in to change notification settings - Fork 92
Clean up Code Climate rubocop style issues #118
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
Conversation
end | ||
|
||
def clean_git_branch | ||
git_branch = String(branch_from_git) | ||
clean = git_branch.sub(/^origin\//, "") unless git_branch.start_with?("(") | ||
clean = git_branch.sub(%r{^origin\/}, "") unless git_branch.start_with?("(") |
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 believe the idea with this cop is that using %r{}
means that /
no longer delimits the beginning and end of the regular expression, so now you're free to no longer escape /
's which appear in the middle of the pattern
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, apparently, is called "leaning toothpick syndrome")
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.
Oo cool. Thanks! Updating
fc25adb
to
7b8c927
Compare
@@ -39,11 +39,11 @@ def format(result) | |||
# actually private ... | |||
def short_filename(filename) | |||
return filename unless ::SimpleCov.root | |||
filename = filename.gsub(/^#{::SimpleCov.root}/, ".").gsub(/^\.\//, "") | |||
filename = filename.gsub(/^#{::SimpleCov.root}/, ".").gsub(%r{^./}, "") |
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.
The .
probably still needs to be escaped, if it's meant to be a literal .
and not the regex wildcard
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.
Thanks :) good catch
LGTM |
def initialize(file_path) | ||
@file_path = file_path | ||
end | ||
|
||
def blob_id | ||
calculate_with_file or calculate_with_git | ||
calculate_with_file || calculate_with_git |
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.
ah, one last note: we recently updated our styleguide to allow this kind of usage of or
(codeclimate/styleguide@3aa6d71) so might be worth considering leaving this one, but up to you
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.
Oo I like that. Updated. Thanks!
e60d519
to
d781e86
Compare
d781e86
to
3fd9246
Compare
@codeclimate/review