Skip to content

Commit

Permalink
Only check if descriptions *start with* FIXME/TODO
Browse files Browse the repository at this point in the history
It doesn't make much sense to just forbid certain words in descriptions.
  • Loading branch information
duckinator committed Sep 11, 2021
1 parent c693b89 commit 7890c98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rubygems/specification_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def validate_licenses
end

LAZY = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
LAZY_PATTERN = /FI XME|TO DO/x.freeze
LAZY_PATTERN = /^FI XME|^TO DO/x.freeze

This comment has been minimized.

Copy link
@nobu

nobu Sep 22, 2021

Contributor

Staring the entire string, or any lines in it?
If you intended the former, /\A(?:FIXME|TODO)/ will fit more.

This comment has been minimized.

Copy link
@duckinator

duckinator Sep 22, 2021

Author Member

Good catch. It should be the entire string. I'm not on a system set up for programming work atm so I opened an issue over at #4926. 👍

HOMEPAGE_URI_PATTERN = /\A[a-z][a-z\d+.-]*:/i.freeze

def validate_lazy_metadata
Expand Down
14 changes: 14 additions & 0 deletions test/rubygems/test_gem_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2781,6 +2781,20 @@ def test_validate_description
end

assert_equal %("#{f}" or "#{t}" is not a description), e.message

# Adding #{f} anywhere after the start of the description should be fine.
@a1.description = "(some description) #{f}"

assert_nothing_raised do
@a1.validate
end

# Adding #{t} anywhere after the start of the description should be fine.
@a1.description = "(some description) #{t}"

assert_nothing_raised do
@a1.validate
end
end
end

Expand Down

0 comments on commit 7890c98

Please sign in to comment.