formula_desc_cop: If desc ends with 'etc.', it's not a violation
This commit is contained in:
parent
302bc8be22
commit
0786d41693
@ -40,7 +40,7 @@ module RuboCop
|
|||||||
# - Checks for correct usage of `command-line` in `desc`
|
# - Checks for correct usage of `command-line` in `desc`
|
||||||
# - Checks description starts with a capital letter
|
# - Checks description starts with a capital letter
|
||||||
# - Checks if `desc` contains the formula name
|
# - 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
|
class Desc < FormulaCop
|
||||||
VALID_LOWERCASE_WORDS = %w[
|
VALID_LOWERCASE_WORDS = %w[
|
||||||
ex
|
ex
|
||||||
@ -83,8 +83,8 @@ module RuboCop
|
|||||||
problem "Description shouldn't start with the formula name"
|
problem "Description shouldn't start with the formula name"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if a full stop is used at the end of a formula's 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, /\.$/)
|
return unless regex_match_group(desc, /\.$/) && !string_content(desc).end_with?("etc.")
|
||||||
problem "Description shouldn't end with a full stop"
|
problem "Description shouldn't end with a full stop"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user