Skip to content

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

Merged
merged 2 commits into from
Aug 18, 2016
Merged

Conversation

ABaldwinHunter
Copy link
Contributor

@codeclimate/review

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?("(")
Copy link
Contributor

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

Copy link
Contributor

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")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oo cool. Thanks! Updating

@@ -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{^./}, "")
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks :) good catch

@maxjacobson
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor Author

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!

@ABaldwinHunter ABaldwinHunter merged commit 794629d into master Aug 18, 2016
@ABaldwinHunter ABaldwinHunter deleted the abh-fix-cc-issues branch August 18, 2016 14:32
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

Successfully merging this pull request may close these issues.

3 participants