-
Notifications
You must be signed in to change notification settings - Fork 349
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
[Linter] Cleanup the github sources checks #200
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -335,23 +335,26 @@ def perform_github_source_checks(s) | |
if git = s[:git] | ||
return unless git =~ /^#{URI.regexp}$/ | ||
git_uri = URI.parse(git) | ||
if git_uri.host == 'www.github.com' | ||
results.add_warning('github_sources', 'Github repositories should ' \ | ||
'not use `www` in their URL.') | ||
end | ||
if git_uri.host == 'github.com' || git_uri.host == 'gist.github.com' | ||
unless git.end_with?('.git') | ||
results.add_warning('github_sources', 'Github repositories ' \ | ||
'should end in `.git`.') | ||
end | ||
unless git_uri.scheme == 'https' | ||
results.add_warning('github_sources', 'Github repositories ' \ | ||
'should use an `https` link.') | ||
end | ||
return unless git_uri.host.end_with?('github.com') | ||
perform_github_uri_checks(git_uri) | ||
unless git.end_with?('.git') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. belongs in the helper method There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
results.add_warning('github_sources', 'Github repositories ' \ | ||
'should end in `.git`.') | ||
end | ||
end | ||
end | ||
|
||
def perform_github_uri_checks(git_uri) | ||
if git_uri.host.start_with?('www.') | ||
results.add_warning('github_sources', 'Github repositories should ' \ | ||
'not use `www` in their URL.') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. second line of the method call should be indented 2 spaces There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
end | ||
unless git_uri.scheme == 'https' | ||
results.add_warning('github_sources', 'Github repositories ' \ | ||
'should use an `https` link.') | ||
end | ||
end | ||
|
||
# Performs validations related to SSH sources | ||
# | ||
def check_git_ssh_source(s) | ||
|
@@ -377,8 +380,6 @@ def _validate_social_media_url(s) | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already a private label higher up in the file. I can add it back if we want it for consistencies sake. |
||
# @!group All specs validation helpers | ||
|
||
private | ||
|
||
# Performs validations related to the `compiler_flags` attribute. | ||
# | ||
def _validate_compiler_flags(flags) | ||
|
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.
perform_github_uri_checks(git_uri) if git_uri.host.end_with?('github.com')
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.
done