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

formula_desc_cop: desc should be capitalised. #2724

Merged
merged 1 commit into from
Jun 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Library/Homebrew/rubocops/formula_desc_cop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,18 @@ def audit_formula(_node, _class_node, _parent_class_node, body)

# Check if command-line is wrongly used in formula's desc
if match = regex_match_group(desc, /(command ?line)/i)
problem "Description should use \"command-line\" instead of \"#{match}\""
c = match.to_s.chars.first
problem "Description should use \"#{c}ommand-line\" instead of \"#{match}\""
end

if match = regex_match_group(desc, /^(an?)\s/i)
problem "Description shouldn't start with an indefinite article (#{match})"
end

if regex_match_group(desc, /^[a-z]/)
problem "Description should start with a capital letter"
end

# Check if formula's name is used in formula's desc
problem "Description shouldn't include the formula name" if regex_match_group(desc, /^#{@formula_name}\b/i)
end
Expand Down