Start hacking checkstyle output in.
checkstyle now shows up on the option parser, and the code still compiles/passes tests. Next up will be outputing the XML to stdout.
This commit is contained in:
parent
3f7741bb0c
commit
0c9f27fe5e
3 changed files with 17 additions and 1 deletions
|
@ -90,7 +90,7 @@ fn execute() -> i32 {
|
|||
opts.optopt("",
|
||||
"write-mode",
|
||||
"mode to write in (not usable when piping from stdin)",
|
||||
"[replace|overwrite|display|diff|coverage]");
|
||||
"[replace|overwrite|display|diff|coverage|checkstyle]");
|
||||
opts.optflag("", "skip-children", "don't reformat child modules");
|
||||
|
||||
opts.optflag("",
|
||||
|
|
|
@ -136,6 +136,8 @@ configuration_option_enum! { WriteMode:
|
|||
Coverage,
|
||||
// Unfancy stdout
|
||||
Plain,
|
||||
// Output a checkstyle XML file.
|
||||
Checkstyle,
|
||||
}
|
||||
|
||||
// This trait and the following impl blocks are there so that we an use
|
||||
|
|
|
@ -38,6 +38,7 @@ pub fn write_all_files(file_map: &FileMap,
|
|||
try!(write_file(&file_map[filename], filename, mode, config));
|
||||
}
|
||||
|
||||
// Output trailers for write mode.
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -142,6 +143,19 @@ pub fn write_file(text: &StringBuffer,
|
|||
WriteMode::Default => {
|
||||
unreachable!("The WriteMode should NEVER Be default at this point!");
|
||||
}
|
||||
WriteMode::Checkstyle => {
|
||||
// Generate the diff for the current file.
|
||||
// Output the XML tags for the lines that are different.
|
||||
// Use the new text as 'should be X'.
|
||||
}
|
||||
WriteMode::Return => {
|
||||
// io::Write is not implemented for String, working around with
|
||||
// Vec<u8>
|
||||
let mut v = Vec::new();
|
||||
try!(write_system_newlines(&mut v, text, config));
|
||||
// won't panic, we are writing correct utf8
|
||||
return Ok(Some(String::from_utf8(v).unwrap()));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
|
|
Loading…
Reference in a new issue