aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2017-11-19 14:39:09 +0000
committerGitHub2017-11-19 14:39:09 +0000
commitc6a5bbac7d8b071e0dbf7cc61e009d0d337c0107 (patch)
tree1d70ac06dc6fae3aaeaa8b9d7e249a8b40593ac9 /Library/Homebrew
parent0cd50400c7c1727ec602a9f8dcdc08678622d61e (diff)
parent5cbb41479731a5ea95fc9ec9a44b39b72df51995 (diff)
downloadbrew-c6a5bbac7d8b071e0dbf7cc61e009d0d337c0107.tar.bz2
Merge pull request #3411 from issyl0/whitelist_etc_and_fix_autocorrect
formula_desc_cop: Whitelist "etc." and fix the full stop autocorrect
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/rubocops/formula_desc_cop.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/rubocops/formula_desc_cop.rb b/Library/Homebrew/rubocops/formula_desc_cop.rb
index 69fbeb56e..8a35e7d24 100644
--- a/Library/Homebrew/rubocops/formula_desc_cop.rb
+++ b/Library/Homebrew/rubocops/formula_desc_cop.rb
@@ -40,7 +40,7 @@ module RuboCop
# - Checks for correct usage of `command-line` in `desc`
# - Checks description starts with a capital letter
# - Checks if `desc` contains the formula name
- # - Checks if `desc` ends with a full stop
+ # - Checks if `desc` ends with a full stop (apart from in the case of "etc.")
class Desc < FormulaCop
VALID_LOWERCASE_WORDS = %w[
ex
@@ -83,8 +83,8 @@ module RuboCop
problem "Description shouldn't start with the formula name"
end
- # Check if a full stop is used at the end of a formula's desc
- return unless regex_match_group(desc, /\.$/)
+ # Check if a full stop is used at the end of a formula's desc (apart from in the case of "etc.")
+ return unless regex_match_group(desc, /\.$/) && !string_content(desc).end_with?("etc.")
problem "Description shouldn't end with a full stop"
end
@@ -103,7 +103,7 @@ module RuboCop
correction.gsub!(/(^|[^a-z])#{@formula_name}([^a-z]|$)/i, "\\1\\2")
correction.gsub!(/^(['"]?)\s+/, "\\1")
correction.gsub!(/\s+(['"]?)$/, "\\1")
- correction.gsub!(/\.$/, "")
+ correction.gsub!(/\.(['"]?)$/, "\\1")
corrector.insert_before(node.source_range, correction)
corrector.remove(node.source_range)
end