diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-04-02 09:50:39 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-04-10 15:57:57 +0300 |
commit | 85212e8ddc54c6ede71912127eaf84aac403f10d (patch) | |
tree | 3d6a86f55231ace670ecdf1a6b42b237db2632f8 /src/doc.rs | |
parent | a3d768162e70004d207a40d803f5d17eeea8593a (diff) | |
download | subplot-85212e8ddc54c6ede71912127eaf84aac403f10d.tar.gz |
feat! treat warnings as errors by default
Add a --merciful option to subcommands for which this matters. Adjust
tests to invoke subplot with that option as necessary.
Sponsored-by: author
Diffstat (limited to 'src/doc.rs')
-rw-r--r-- | src/doc.rs | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -161,6 +161,11 @@ impl<'a> Document { style: Style, template: Option<&str>, ) -> Result<Document> { + trace!( + "Document::from_file: basedir={} filename={}", + basedir.display(), + filename.display() + ); let markdowns = vec![filename.to_path_buf()]; let mut pandoc = pandoc::new(); @@ -180,6 +185,7 @@ impl<'a> Document { pandoc::PandocOutput::ToBuffer(o) => o, _ => return Err(SubplotError::NotJson), }; + trace!("Pandoc was happy"); let doc = Document::from_json(basedir, markdowns, &output, style, template)?; trace!("Loaded document OK"); Ok(doc) @@ -223,7 +229,7 @@ impl<'a> Document { /// /// The sources are any files that affect the output so that if /// the source file changes, the output needs to be re-generated. - pub fn sources(&mut self, template: Option<&str>) -> Vec<PathBuf> { + pub fn sources(&mut self, template: &Option<String>) -> Vec<PathBuf> { let mut names = vec![]; for x in self.meta().bindings_filenames() { @@ -352,7 +358,10 @@ impl<'a> Document { if matches!(step.types().get(name.as_str()), Some(CaptureType::File)) && !filenames.contains(&text.to_lowercase()) { - self.warnings.push(Warning::UnknownEmbeddedFile(text.to_string())); + self.warnings.push(Warning::UnknownEmbeddedFile( + scenario.title().to_string(), + text.to_string(), + )); okay = false; } } @@ -386,7 +395,8 @@ impl<'a> Document { } } for filename in filenames.iter() { - self.warnings.push(Warning::UnusedEmbeddedFile(filename.to_string())); + self.warnings + .push(Warning::UnusedEmbeddedFile(filename.to_string())); } // We always succeed. Subplot's own subplot had valid cases of @@ -410,7 +420,10 @@ impl<'a> Document { for step in scenario.steps() { if step.function().is_none() { trace!("Missing step implementation: {:?}", step.text()); - self.warnings.push(Warning::MissingStepImplementation(step.text().to_string())); + self.warnings.push(Warning::MissingStepImplementation( + scenario.title().to_string(), + step.text().to_string(), + )); okay = false; } } |