mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Ruby: improve wording of error messages
This commit is contained in:
@@ -306,15 +306,20 @@ impl<'a> Visitor<'a> {
|
|||||||
fn enter_node(&mut self, node: Node) -> bool {
|
fn enter_node(&mut self, node: Node) -> bool {
|
||||||
if node.is_missing() {
|
if node.is_missing() {
|
||||||
self.record_parse_error_for_node(
|
self.record_parse_error_for_node(
|
||||||
"parse error: expecting {}",
|
"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.",
|
||||||
&[node.kind()],
|
&[node.kind(), "ruby -c"],
|
||||||
node,
|
node,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if node.is_error() {
|
if node.is_error() {
|
||||||
self.record_parse_error_for_node("parse error", &[], node, true);
|
self.record_parse_error_for_node(
|
||||||
|
"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.",
|
||||||
|
&["ruby -c"],
|
||||||
|
node,
|
||||||
|
true,
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ fn main() -> std::io::Result<()> {
|
|||||||
)
|
)
|
||||||
.file(&path.to_string_lossy())
|
.file(&path.to_string_lossy())
|
||||||
.message(
|
.message(
|
||||||
"could not decode the file contents as {}: {}",
|
"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.",
|
||||||
&[&encoding_name, &msg],
|
&[&encoding_name, &msg, "encoding:"],
|
||||||
)
|
)
|
||||||
.status_page()
|
.status_page()
|
||||||
.severity(diagnostics::Severity::Warning),
|
.severity(diagnostics::Severity::Warning),
|
||||||
@@ -218,7 +218,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
.new_entry("unknown-character-encoding", "Unknown character encoding")
|
.new_entry("unknown-character-encoding", "Unknown character encoding")
|
||||||
.file(&path.to_string_lossy())
|
.file(&path.to_string_lossy())
|
||||||
.message(
|
.message(
|
||||||
"unknown character encoding {} in {} directive.",
|
"Unknown character encoding {} in {} directive. Validate that the specified name is a supported character set.",
|
||||||
&[&encoding_name, "#encoding:"],
|
&[&encoding_name, "#encoding:"],
|
||||||
)
|
)
|
||||||
.status_page()
|
.status_page()
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
| src/not_ruby.rb:5:25:5:26 | parse error | Extraction failed in src/not_ruby.rb with error parse error | 2 |
|
| src/not_ruby.rb:5:25:5:26 | A parse error occured. Check the syntax of the file using the ruby -c command. If the file is invalid, please correct the error or exclude the file from analysis. | Extraction failed in src/not_ruby.rb with error A parse error occured. Check the syntax of the file using the ruby -c command. If the file is invalid, please correct the error or exclude the file from analysis. | 2 |
|
||||||
| src/unsupported_feature.rb:2:1:2:4 | parse error | Extraction failed in src/unsupported_feature.rb with error parse error | 2 |
|
| src/unsupported_feature.rb:2:1:2:4 | A parse error occured. Check the syntax of the file using the ruby -c command. If the file is invalid, please correct the error or exclude the file from analysis. | Extraction failed in src/unsupported_feature.rb with error A parse error occured. Check the syntax of the file using the ruby -c command. If the file is invalid, please correct the error or exclude the file from analysis. | 2 |
|
||||||
| src/unsupported_feature.rb:3:1:3:8 | parse error | Extraction failed in src/unsupported_feature.rb with error parse error | 2 |
|
| src/unsupported_feature.rb:3:1:3:8 | A parse error occured. Check the syntax of the file using the ruby -c command. If the file is invalid, please correct the error or exclude the file from analysis. | Extraction failed in src/unsupported_feature.rb with error A parse error occured. Check the syntax of the file using the ruby -c command. If the file is invalid, please correct the error or exclude the file from analysis. | 2 |
|
||||||
|
|||||||
Reference in New Issue
Block a user