Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feed info validator #42

Merged
merged 3 commits into from
Feb 14, 2019
Merged

Feed info validator #42

merged 3 commits into from
Feb 14, 2019

Conversation

BaptisteB-A
Copy link
Contributor

@BaptisteB-A BaptisteB-A commented Feb 12, 2019

Added validator on feed info to check the publisher name, url and language.
Added dataset and tests

@antoine-de
Copy link
Member

this PR needs a rebase

…into feed

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	src/validators/issues.rs
#	src/validators/mod.rs
!feed.url.is_empty()
}

fn valid_url(feed: &gtfs_structures::FeedInfo) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

minor: you can rewrite this as:
url::Url::parse(feed.url.as_ref()).map_or(|_| false, |url| vec!["https", "http", "ftp"].contains(&url.scheme()))

alternativly (I'm not sure it's better though) you can do:

url::Url::parse(feed.url.as_ref()).map_or(|_| false, |url| match url.scheme.as_ref() {
"https" | "http" | "ftp" => true,
_ => false,

@antoine-de antoine-de merged commit 7de0eee into etalab:master Feb 14, 2019
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.

2 participants