mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Apply suggestions from code review
Co-authored-by: Harry Maclean <hmac@github.com>
This commit is contained in:
@@ -215,52 +215,52 @@ impl DiagnosticMessage {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn text<'a>(&'a mut self, text: &str) -> &'a mut Self {
|
||||
pub fn text(&mut self, text: &str) -> &mut Self {
|
||||
self.plaintext_message = text.to_owned();
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn markdown<'a>(&'a mut self, text: &str) -> &'a mut Self {
|
||||
pub fn markdown(&mut self, text: &str) -> &mut Self {
|
||||
self.markdown_message = text.to_owned();
|
||||
self
|
||||
}
|
||||
pub fn severity<'a>(&'a mut self, severity: Severity) -> &'a mut Self {
|
||||
pub fn severity(&mut self, severity: Severity) -> &mut Self {
|
||||
self.severity = Some(severity);
|
||||
self
|
||||
}
|
||||
#[allow(unused)]
|
||||
pub fn help_link<'a>(&'a mut self, link: &str) -> &'a mut Self {
|
||||
pub fn help_link(&mut self, link: &str) -> &mut Self {
|
||||
self.help_links.push(link.to_owned());
|
||||
self
|
||||
}
|
||||
#[allow(unused)]
|
||||
pub fn internal<'a>(&'a mut self) -> &'a mut Self {
|
||||
pub fn internal(&mut self) -> &mut Self {
|
||||
self.internal = true;
|
||||
self
|
||||
}
|
||||
#[allow(unused)]
|
||||
pub fn cli_summary_table<'a>(&'a mut self) -> &'a mut Self {
|
||||
pub fn cli_summary_table(&mut self) -> &mut Self {
|
||||
self.visibility.cli_summary_table = true;
|
||||
self
|
||||
}
|
||||
pub fn status_page<'a>(&'a mut self) -> &'a mut Self {
|
||||
pub fn status_page(&mut self) -> &mut Self {
|
||||
self.visibility.status_page = true;
|
||||
self
|
||||
}
|
||||
#[allow(unused)]
|
||||
pub fn telemetry<'a>(&'a mut self) -> &'a mut Self {
|
||||
pub fn telemetry(&mut self) -> &mut Self {
|
||||
self.visibility.telemetry = true;
|
||||
self
|
||||
}
|
||||
pub fn location<'a>(
|
||||
&'a mut self,
|
||||
pub fn location(
|
||||
&mut self,
|
||||
path: &str,
|
||||
start_line: usize,
|
||||
start_column: usize,
|
||||
end_line: usize,
|
||||
end_column: usize,
|
||||
) -> &'a mut Self {
|
||||
) -> &mut Self {
|
||||
let loc = self.location.get_or_insert(Default::default());
|
||||
loc.file = Some(path.to_owned());
|
||||
loc.start_line = Some(start_line);
|
||||
|
||||
@@ -588,8 +588,8 @@ fn location_for(visitor: &mut Visitor, n: Node) -> (usize, usize, usize, usize)
|
||||
if index > 0 && index <= source.len() {
|
||||
index -= 1;
|
||||
if source[index] != b'\n' {
|
||||
&visitor.diagnostics_writer.write(
|
||||
&visitor
|
||||
visitor.diagnostics_writer.write(
|
||||
visitor
|
||||
.diagnostics_writer
|
||||
.message("internal-error", "Internal error")
|
||||
.text("expecting a line break symbol, but none found while correcting end column value")
|
||||
@@ -604,8 +604,8 @@ fn location_for(visitor: &mut Visitor, n: Node) -> (usize, usize, usize, usize)
|
||||
end_col += 1;
|
||||
}
|
||||
} else {
|
||||
&visitor.diagnostics_writer.write(
|
||||
&visitor
|
||||
visitor.diagnostics_writer.write(
|
||||
visitor
|
||||
.diagnostics_writer
|
||||
.message("internal-error", "Internal error")
|
||||
.text(&format!(
|
||||
|
||||
@@ -67,12 +67,12 @@ fn main() -> std::io::Result<()> {
|
||||
)
|
||||
.init();
|
||||
let diagnostics = diagnostics::DiagnosticLoggers::new("ruby");
|
||||
let main_thread_logger = &mut diagnostics.logger();
|
||||
let mut main_thread_logger = diagnostics.logger();
|
||||
let num_threads = match num_codeql_threads() {
|
||||
Ok(num) => num,
|
||||
Err(e) => {
|
||||
main_thread_logger.write(
|
||||
&main_thread_logger
|
||||
main_thread_logger
|
||||
.message("configuration-error", "Configuration error")
|
||||
.text(&format!("{}; defaulting to 1 thread.", e))
|
||||
.status_page()
|
||||
@@ -94,7 +94,7 @@ fn main() -> std::io::Result<()> {
|
||||
Ok(x) => x,
|
||||
Err(e) => {
|
||||
main_thread_logger.write(
|
||||
&main_thread_logger
|
||||
main_thread_logger
|
||||
.message("configuration-error", "Configuration error")
|
||||
.text(&format!("{}; using gzip.", e))
|
||||
.status_page()
|
||||
@@ -198,7 +198,7 @@ fn main() -> std::io::Result<()> {
|
||||
Err(msg) => {
|
||||
needs_conversion = false;
|
||||
diagnostics_writer.write(
|
||||
&diagnostics_writer
|
||||
diagnostics_writer
|
||||
.message(
|
||||
"character-encoding-error",
|
||||
"Character encoding error",
|
||||
@@ -217,7 +217,7 @@ fn main() -> std::io::Result<()> {
|
||||
}
|
||||
} else {
|
||||
diagnostics_writer.write(
|
||||
&diagnostics_writer
|
||||
diagnostics_writer
|
||||
.message("character-encoding-error", "Character encoding error")
|
||||
.text(&format!(
|
||||
"{}: unknown character encoding: '{}'",
|
||||
|
||||
Reference in New Issue
Block a user