diff --git a/.travis.yml b/.travis.yml index e6e05dcd..0ed1e1ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: rust -script: cargo run check # check that the advisory-db is well-formed +cache: cargo + +# check that the advisory-db is well-formed +script: cargo run check branches: only: diff --git a/src/main.rs b/src/main.rs index 209eea46..04562bc5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,4 +102,19 @@ fn check_advisory(cratesio_client: &crates_io_api::SyncClient, advisory: &rustse advisory.package.as_str() ); } + + // Check that each path in `affected_paths` starts with the crate name + if let Some(ref version_req_paths) = advisory.affected_paths { + for (_, paths) in version_req_paths.iter() { + for path in paths { + if path.crate_name() != response.crate_data.name { + panic!( + "{}: affected_path does not begin with crate name: {}", + response.crate_data.name, + path.crate_name() + ) + } + } + } + } }