Skip to content

Validate metadata link keys#1834

Merged
homu merged 2 commits into
ruby:masterfrom
sonalkr132:metadata_links
Mar 8, 2017
Merged

Validate metadata link keys#1834
homu merged 2 commits into
ruby:masterfrom
sonalkr132:metadata_links

Conversation

@sonalkr132
Copy link
Copy Markdown
Contributor

Description:

We intend to deprecate form used to edit linkset of gems. Metadata will be the only way to specify homepage, codebase, documentation, wiki, mailing list and issue tracker urls.

Related: rubygems/rubygems.org#1234
rubygems/rubygems.org#1557

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

Comment thread lib/rubygems/specification.rb Outdated
# "bugs" => "https://example.com/user/bestgemever/issues"
# }
#
# These links will be used on your gem's page on rubygems.org amd must pass
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, "amd" instead of "and"

# These links will be used on your gem's page on rubygems.org amd must pass
# validation against following regex.
#
# %r{\Ahttps?:\/\/([^\s:@]+:[^\s:@]*@)?[A-Za-z\d\-]+(\.[A-Za-z\d\-]+)+\.?(:\d{1,5})?([\/?]\S*)?\z}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we actually validate this in RubyGems are well as on .org ?

@sonalkr132
Copy link
Copy Markdown
Contributor Author

Should we actually validate this in RubyGems are well as on .org ?

Yes. I think we should validate both on client and the server. Doing it on client would provide immediate feedback and server side validation is for just in case (dealing with invalid links is painful). I think there is a flag which ignores the validation checks during gem build.

@segiddins
Copy link
Copy Markdown
Contributor

Then let's validate the links instead of just documenting the valid format -- that way gem build is more aligned with what the server will do on gem push

@sonalkr132 sonalkr132 changed the title Add documentation about metadata links Validate metadata link keys Feb 27, 2017
Comment thread lib/rubygems/specification.rb Outdated
if link_keys.include? key
if value !~ url_validation_regex
raise Gem::InvalidSpecificationException,
"metadata['#{key}'] has invalid link: #{value}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe value.inspect?

@segiddins
Copy link
Copy Markdown
Contributor

👍 other than the one small comment (I hadn't realized you'd addressed my comment)

These keys will be validated on server and gem push will fail for
invalid links.
@sonalkr132
Copy link
Copy Markdown
Contributor Author

Updated 💬

@segiddins
Copy link
Copy Markdown
Contributor

👌🏻

@indirect
Copy link
Copy Markdown

indirect commented Mar 8, 2017

@homu r+

@homu
Copy link
Copy Markdown
Contributor

homu commented Mar 8, 2017

📌 Commit 4b7a695 has been approved by indirect

@homu
Copy link
Copy Markdown
Contributor

homu commented Mar 8, 2017

⚡ Test exempted - status

@homu homu merged commit 4b7a695 into ruby:master Mar 8, 2017
homu added a commit that referenced this pull request Mar 8, 2017
Validate metadata link keys

# Description:

We intend to deprecate form used to edit linkset of gems. Metadata will be the only way to specify homepage, codebase, documentation, wiki, mailing list and issue tracker urls.

Related: rubygems/rubygems.org#1234
rubygems/rubygems.org#1557
# Tasks:

- [x] Describe the problem / feature
- [ ] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).
@sonalkr132 sonalkr132 deleted the metadata_links branch April 3, 2017 19:49
sonalkr132 added a commit to sonalkr132/rubygems that referenced this pull request Apr 3, 2017
homu added a commit that referenced this pull request Apr 3, 2017
Add changelog to metadata validation

Ref: #1834
rubygems/rubygems.org#1553

# Description:
We need to validate changelog link during `gem build`.

# Tasks:

- [x] Describe the problem / feature
- [ ] Write tests
- [x] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants