From fcaa918445c85c7b21d83f8eda2d237eace4b315 Mon Sep 17 00:00:00 2001 From: Ellen Marie Dash Date: Fri, 24 Sep 2021 17:54:08 -0400 Subject: [PATCH] [rubygems/rubygems] Only disallow FIXME/TODO for first word of gemspec description 7890c98 matched the start of each line, whereas this matches the start of the entire string. https://github.com/rubygems/rubygems/commit/432de7b819 --- lib/rubygems/specification_policy.rb | 2 +- test/rubygems/test_gem_specification.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb index c30ec707d9..73bd31970c 100644 --- a/lib/rubygems/specification_policy.rb +++ b/lib/rubygems/specification_policy.rb @@ -381,7 +381,7 @@ http://spdx.org/licenses or '#{Gem::Licenses::NONSTANDARD}' for a nonstandard li end LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '') - LAZY_PATTERN = /^FI XME|^TO DO/x.freeze + LAZY_PATTERN = /\AFI XME|\ATO DO/x.freeze HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze def validate_lazy_metadata diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb index 782ae0380f..336fcf000e 100644 --- a/test/rubygems/test_gem_specification.rb +++ b/test/rubygems/test_gem_specification.rb @@ -2795,6 +2795,20 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use: assert_nothing_raised do @a1.validate end + + # Adding #{f} at the start of the second or later line should be fine. + @a1.description = "(some description)\n#{f}" + + assert_nothing_raised do + @a1.validate + end + + # Adding #{t} at the start of the second or later line should be fine. + @a1.description = "(some description)\n#{t}" + + assert_nothing_raised do + @a1.validate + end end end