Skip to content

Commit 2c611d3

Browse files
committed
Address review comments
1 parent 6c57823 commit 2c611d3

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

ruby/extractor/src/extractor.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl<'a> Visitor<'a> {
306306
fn enter_node(&mut self, node: Node) -> bool {
307307
if node.is_missing() {
308308
self.record_parse_error_for_node(
309-
"A parse error occurred, expecting {} symbol. Check the syntax of the file using the {} command. If the file is indeed invalid, please correct the error or exclude the file from analysis.",
309+
"A parse error occurred (expected {} symbol). Check the syntax of the file using the {} command. If the file is invalid, correct the error or exclude the file from analysis.",
310310
&[node.kind(), "ruby -c"],
311311
node,
312312
true,
@@ -315,7 +315,7 @@ impl<'a> Visitor<'a> {
315315
}
316316
if node.is_error() {
317317
self.record_parse_error_for_node(
318-
"A parse error occurred. Check the syntax of the file using the {} command. If the file is indeed invalid, please correct the error or exclude the file from analysis.",
318+
"A parse error occurred. Check the syntax of the file using the {} command. If the file is invalid, correct the error or exclude the file from analysis.",
319319
&["ruby -c"],
320320
node,
321321
true,
@@ -407,7 +407,7 @@ impl<'a> Visitor<'a> {
407407
.new_entry("parse-error", "Parse error")
408408
.severity(diagnostics::Severity::Error)
409409
.location(self.path, start_line, start_column, end_line, end_column)
410-
.message("unknown table type: {}", &[node.kind()]),
410+
.message("Unknown table type: {}", &[node.kind()]),
411411
);
412412

413413
valid = false;
@@ -456,7 +456,7 @@ impl<'a> Visitor<'a> {
456456
}
457457
} else if field.name.is_some() {
458458
self.record_parse_error_for_node(
459-
"type mismatch for field {}::{} with type {} != {}",
459+
"Type mismatch for field {}::{} with type {} != {}",
460460
&[
461461
node.kind(),
462462
child_node.field_name.unwrap_or("child"),
@@ -469,7 +469,7 @@ impl<'a> Visitor<'a> {
469469
}
470470
} else if child_node.field_name.is_some() || child_node.type_name.named {
471471
self.record_parse_error_for_node(
472-
"value for unknown field: {}::{} and type {}",
472+
"Value for unknown field: {}::{} and type {}",
473473
&[
474474
node.kind(),
475475
&child_node.field_name.unwrap_or("child"),
@@ -493,9 +493,9 @@ impl<'a> Visitor<'a> {
493493
let error_message = format!(
494494
"{} for field: {}::{}",
495495
if child_values.is_empty() {
496-
"missing value"
496+
"Missing value"
497497
} else {
498-
"too many values"
498+
"Too many values"
499499
},
500500
node.kind(),
501501
column_name
@@ -511,7 +511,7 @@ impl<'a> Visitor<'a> {
511511
for (index, child_value) in child_values.iter().enumerate() {
512512
if !*has_index && index > 0 {
513513
self.record_parse_error_for_node(
514-
"too many values for field: {}::{}",
514+
"Too many values for field: {}::{}",
515515
&[node.kind(), table_name],
516516
*node,
517517
false,
@@ -613,7 +613,7 @@ fn location_for(visitor: &mut Visitor, n: Node) -> (usize, usize, usize, usize)
613613
visitor
614614
.diagnostics_writer
615615
.new_entry("internal-error", "Internal error")
616-
.message("expecting a line break symbol, but none found while correcting end column value", &[])
616+
.message("Expecting a line break symbol, but none found while correcting end column value", &[])
617617
.severity(diagnostics::Severity::Error),
618618
);
619619
}
@@ -629,7 +629,7 @@ fn location_for(visitor: &mut Visitor, n: Node) -> (usize, usize, usize, usize)
629629
.diagnostics_writer
630630
.new_entry("internal-error", "Internal error")
631631
.message(
632-
"cannot correct end column value: end_byte index {} is not in range [1,{}]",
632+
"Cannot correct end column value: end_byte index {} is not in range [1,{}]",
633633
&[&index.to_string(), &source.len().to_string()],
634634
)
635635
.severity(diagnostics::Severity::Error),

ruby/extractor/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,11 @@ fn main() -> std::io::Result<()> {
203203
)
204204
.file(&path.to_string_lossy())
205205
.message(
206-
"Could not decode the file contents as {}: {}. Validate that the contents of the file matches the character encoding specified in the {} directive at the top of the file.",
206+
"Could not decode the file contents as {}: {}. The contents of the file must match the character encoding specified in the {} directive.",
207207
&[&encoding_name, &msg, "encoding:"],
208208
)
209209
.status_page()
210+
.help_link("https://docs.ruby-lang.org/en/master/syntax/comments_rdoc.html#label-encoding+Directive")
210211
.severity(diagnostics::Severity::Warning),
211212
);
212213
}
@@ -218,11 +219,11 @@ fn main() -> std::io::Result<()> {
218219
.new_entry("unknown-character-encoding", "Unknown character encoding")
219220
.file(&path.to_string_lossy())
220221
.message(
221-
"Unknown character encoding {} in {} directive. Validate that the specified name is a supported character set.",
222+
"Unknown character encoding {} in {} directive.",
222223
&[&encoding_name, "#encoding:"],
223224
)
224225
.status_page()
225-
.help_link("https://docs.ruby-lang.org/en/3.2/syntax/comments_rdoc.html#label-encoding+Directive")
226+
.help_link("https://docs.ruby-lang.org/en/master/syntax/comments_rdoc.html#label-encoding+Directive")
226227
.severity(diagnostics::Severity::Warning),
227228
);
228229
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| src/not_ruby.rb:5:25:5:26 | A parse error occurred. Check the syntax of the file using the ruby -c command. If the file is indeed invalid, please correct the error or exclude the file from analysis. | Extraction failed in src/not_ruby.rb with error A parse error occurred. Check the syntax of the file using the ruby -c command. If the file is indeed invalid, please correct the error or exclude the file from analysis. | 2 |
1+
| src/not_ruby.rb:5:25:5:26 | A parse error occurred. Check the syntax of the file using the ruby -c command. If the file is invalid, correct the error or exclude the file from analysis. | Extraction failed in src/not_ruby.rb with error A parse error occurred. Check the syntax of the file using the ruby -c command. If the file is invalid, correct the error or exclude the file from analysis. | 2 |

0 commit comments

Comments
 (0)