英語修正 (#236)
* 英語修正 * cargo fmt * fixed test assertion string data Co-authored-by: DustInDark <nextsasasa@gmail.com>
This commit is contained in:
@@ -52,7 +52,7 @@ impl AggegationConditionCompiler {
|
||||
let result = self.compile_body(condition_str);
|
||||
if let Result::Err(msg) = result {
|
||||
return Result::Err(format!(
|
||||
"aggregation condition parse error has occurred. {}",
|
||||
"An aggregation condition parse error has occurred. {}",
|
||||
msg
|
||||
));
|
||||
} else {
|
||||
@@ -137,7 +137,7 @@ impl AggegationConditionCompiler {
|
||||
) -> Result<Option<AggregationParseInfo>, String> {
|
||||
if tokens.is_empty() {
|
||||
// パイプしか無いのはおかしいのでエラー
|
||||
return Result::Err("There are no strings after pipe(|).".to_string());
|
||||
return Result::Err("There are no strings after the pipe(|).".to_string());
|
||||
}
|
||||
|
||||
let mut token_ite = tokens.into_iter();
|
||||
@@ -150,14 +150,14 @@ impl AggegationConditionCompiler {
|
||||
}
|
||||
} else {
|
||||
// いろんなパターンがあるので難しいが、countというキーワードしか使えないことを説明しておく。
|
||||
return Result::Err("aggregation condition can use count only.".to_string());
|
||||
return Result::Err("The aggregation condition can only use count.".to_string());
|
||||
}
|
||||
|
||||
let token = token_ite.next();
|
||||
if token.is_none() {
|
||||
// 論理演算子がないのはだめ
|
||||
return Result::Err(
|
||||
"count keyword needs compare operator and number like '> 3'".to_string(),
|
||||
"The count keyword needs a compare operator and number like '> 3'".to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -168,14 +168,18 @@ impl AggegationConditionCompiler {
|
||||
let after_by = token_ite.next();
|
||||
if after_by.is_none() {
|
||||
// BYの後に何もないのはだめ
|
||||
return Result::Err("by keyword needs field name like 'by EventID'".to_string());
|
||||
return Result::Err(
|
||||
"The by keyword needs a field name like 'by EventID'".to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
if let AggregationConditionToken::KEYWORD(keyword) = after_by.unwrap() {
|
||||
by_field_name = Option::Some(keyword);
|
||||
token_ite.next()
|
||||
} else {
|
||||
return Result::Err("by keyword needs field name like 'by EventID'".to_string());
|
||||
return Result::Err(
|
||||
"The by keyword needs a field name like 'by EventID'".to_string(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Option::Some(token)
|
||||
@@ -185,14 +189,14 @@ impl AggegationConditionCompiler {
|
||||
if token.is_none() {
|
||||
// 論理演算子がないのはだめ
|
||||
return Result::Err(
|
||||
"count keyword needs compare operator and number like '> 3'".to_string(),
|
||||
"The count keyword needs a compare operator and number like '> 3'".to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
let cmp_token = token.unwrap();
|
||||
if !self.is_cmp_op(&cmp_token) {
|
||||
return Result::Err(
|
||||
"count keyword needs compare operator and number like '> 3'".to_string(),
|
||||
"The count keyword needs a compare operator and number like '> 3'".to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,17 +205,17 @@ impl AggegationConditionCompiler {
|
||||
let number: Result<i32, _> = number.parse();
|
||||
if number.is_err() {
|
||||
// 比較演算子の後に数値が無い。
|
||||
return Result::Err("compare operator needs a number like '> 3'.".to_string());
|
||||
return Result::Err("The compare operator needs a number like '> 3'.".to_string());
|
||||
} else {
|
||||
number.unwrap()
|
||||
}
|
||||
} else {
|
||||
// 比較演算子の後に数値が無い。
|
||||
return Result::Err("compare operator needs a number like '> 3'.".to_string());
|
||||
return Result::Err("The compare operator needs a number like '> 3'.".to_string());
|
||||
};
|
||||
|
||||
if token_ite.next().is_some() {
|
||||
return Result::Err("unnecessary word was found.".to_string());
|
||||
return Result::Err("An unnecessary word was found.".to_string());
|
||||
}
|
||||
|
||||
let info = AggregationParseInfo {
|
||||
@@ -379,7 +383,7 @@ mod tests {
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!(
|
||||
"aggregation condition parse error has occurred. There are no strings after pipe(|)."
|
||||
"An aggregation condition parse error has occurred. There are no strings after the pipe(|)."
|
||||
.to_string(),
|
||||
result.unwrap_err()
|
||||
);
|
||||
@@ -393,7 +397,7 @@ mod tests {
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!(
|
||||
"aggregation condition parse error has occurred. An unusable character was found."
|
||||
"An aggregation condition parse error has occurred. An unusable character was found."
|
||||
.to_string(),
|
||||
result.unwrap_err()
|
||||
);
|
||||
@@ -407,7 +411,7 @@ mod tests {
|
||||
compiler.compile("select1 or select2 | by count( hogehoge) by snsn > 3".to_string());
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!("aggregation condition parse error has occurred. aggregation condition can use count only.".to_string(),result.unwrap_err());
|
||||
assert_eq!("An aggregation condition parse error has occurred. The aggregation condition can only use count.".to_string(),result.unwrap_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -417,7 +421,7 @@ mod tests {
|
||||
let result = compiler.compile("select1 or select2 | count( hogehoge) 3".to_string());
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!("aggregation condition parse error has occurred. count keyword needs compare operator and number like '> 3'".to_string(),result.unwrap_err());
|
||||
assert_eq!("An aggregation condition parse error has occurred. The count keyword needs a compare operator and number like '> 3'".to_string(),result.unwrap_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -427,7 +431,7 @@ mod tests {
|
||||
let result = compiler.compile("select1 or select2 | count( hogehoge) by".to_string());
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!("aggregation condition parse error has occurred. by keyword needs field name like 'by EventID'".to_string(),result.unwrap_err());
|
||||
assert_eq!("An aggregation condition parse error has occurred. The by keyword needs a field name like 'by EventID'".to_string(),result.unwrap_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -438,7 +442,7 @@ mod tests {
|
||||
compiler.compile("select1 or select2 | count( hogehoge ) by hoe >".to_string());
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!("aggregation condition parse error has occurred. compare operator needs a number like '> 3'.".to_string(),result.unwrap_err());
|
||||
assert_eq!("An aggregation condition parse error has occurred. The compare operator needs a number like '> 3'.".to_string(),result.unwrap_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -450,7 +454,7 @@ mod tests {
|
||||
|
||||
assert_eq!(true, result.is_err());
|
||||
assert_eq!(
|
||||
"aggregation condition parse error has occurred. unnecessary word was found."
|
||||
"An aggregation condition parse error has occurred. An unnecessary word was found."
|
||||
.to_string(),
|
||||
result.unwrap_err()
|
||||
);
|
||||
|
||||
@@ -130,7 +130,7 @@ impl ConditionCompiler {
|
||||
|
||||
let result = self.compile_condition_body(condition_str, name_2_node);
|
||||
if let Result::Err(msg) = result {
|
||||
return Result::Err(format!("condition parse error has occured. {}", msg));
|
||||
return Result::Err(format!("A condition parse error has occured. {}", msg));
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ impl ConditionCompiler {
|
||||
}
|
||||
// 最後までついても対応する右括弧が見つからないことを表している
|
||||
if left_cnt != right_cnt {
|
||||
return Result::Err("expected ')'. but not found.".to_string());
|
||||
return Result::Err("')' was expected but not found.".to_string());
|
||||
}
|
||||
|
||||
// ここで再帰的に呼び出す。
|
||||
@@ -284,7 +284,7 @@ impl ConditionCompiler {
|
||||
};
|
||||
});
|
||||
if is_right_left {
|
||||
return Result::Err("expected '('. but not found.".to_string());
|
||||
return Result::Err("'(' was expected but not found.".to_string());
|
||||
}
|
||||
|
||||
return Result::Ok(ret);
|
||||
@@ -294,7 +294,7 @@ impl ConditionCompiler {
|
||||
fn parse_and_or_operator(&self, tokens: Vec<ConditionToken>) -> Result<ConditionToken, String> {
|
||||
if tokens.len() == 0 {
|
||||
// 長さ0は呼び出してはいけない
|
||||
return Result::Err("unknown error.".to_string());
|
||||
return Result::Err("Unknown error.".to_string());
|
||||
}
|
||||
|
||||
// まず、selection1 and not selection2みたいな式のselection1やnot selection2のように、ANDやORでつながるトークンをまとめる。
|
||||
@@ -302,7 +302,7 @@ impl ConditionCompiler {
|
||||
|
||||
// 先頭又は末尾がAND/ORなのはだめ
|
||||
if self.is_logical(&tokens[0]) || self.is_logical(&tokens[tokens.len() - 1]) {
|
||||
return Result::Err("illegal Logical Operator(and, or) was found.".to_string());
|
||||
return Result::Err("An illegal logical operator(and, or) was found.".to_string());
|
||||
}
|
||||
|
||||
// OperandContainerとLogicalOperator(AndとOR)が交互に並んでいるので、それぞれリストに投入
|
||||
@@ -311,7 +311,9 @@ impl ConditionCompiler {
|
||||
for (i, token) in tokens.into_iter().enumerate() {
|
||||
if (i % 2 == 1) != self.is_logical(&token) {
|
||||
// インデックスが奇数の時はLogicalOperatorで、インデックスが偶数のときはOperandContainerになる
|
||||
return Result::Err("The use of logical operator(and, or) was wrong.".to_string());
|
||||
return Result::Err(
|
||||
"The use of a logical operator(and, or) was wrong.".to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
if i % 2 == 0 {
|
||||
@@ -354,21 +356,21 @@ impl ConditionCompiler {
|
||||
// 上記の通り、3つ以上入っていることはないはず。
|
||||
if sub_tokens.len() >= 3 {
|
||||
return Result::Err(
|
||||
"unknown error. maybe it's because there are multiple name of selection node."
|
||||
"Unknown error. Maybe it is because there are multiple names of selection nodes."
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
// 0はありえないはず
|
||||
if sub_tokens.len() == 0 {
|
||||
return Result::Err("unknown error.".to_string());
|
||||
return Result::Err("Unknown error.".to_string());
|
||||
}
|
||||
|
||||
// 1つだけ入っている場合、NOTはありえない。
|
||||
if sub_tokens.len() == 1 {
|
||||
let operand_subtoken = sub_tokens.into_iter().next().unwrap();
|
||||
if let ConditionToken::Not = operand_subtoken {
|
||||
return Result::Err("illegal not was found.".to_string());
|
||||
return Result::Err("An illegal not was found.".to_string());
|
||||
}
|
||||
|
||||
return Result::Ok(operand_subtoken);
|
||||
@@ -380,14 +382,14 @@ impl ConditionCompiler {
|
||||
let second_token = sub_tokens_ite.next().unwrap();
|
||||
if let ConditionToken::Not = first_token {
|
||||
if let ConditionToken::Not = second_token {
|
||||
return Result::Err("not is continuous.".to_string());
|
||||
return Result::Err("Not is continuous.".to_string());
|
||||
} else {
|
||||
let not_container = ConditionToken::NotContainer(vec![second_token]);
|
||||
return Result::Ok(not_container);
|
||||
}
|
||||
} else {
|
||||
return Result::Err(
|
||||
"unknown error. maybe it's because there are multiple name of selection node."
|
||||
"Unknown error. Maybe it is because there are multiple names of selection nodes."
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
@@ -450,7 +452,7 @@ impl ConditionCompiler {
|
||||
// NotSelectionNodeに変換
|
||||
if let ConditionToken::NotContainer(sub_tokens) = token {
|
||||
if sub_tokens.len() > 1 {
|
||||
return Result::Err("unknown error".to_string());
|
||||
return Result::Err("Unknown error".to_string());
|
||||
}
|
||||
|
||||
let select_sub_node =
|
||||
@@ -459,7 +461,7 @@ impl ConditionCompiler {
|
||||
return Result::Ok(Box::new(select_not_node));
|
||||
}
|
||||
|
||||
return Result::Err("unknown error".to_string());
|
||||
return Result::Err("Unknown error".to_string());
|
||||
}
|
||||
|
||||
/// ConditionTokenがAndまたはOrTokenならばTrue
|
||||
@@ -549,7 +551,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -595,7 +597,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -642,7 +644,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1204,7 +1206,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
rule_node.init(),
|
||||
Err(vec![
|
||||
"There are no condition node under detection.".to_string()
|
||||
"There is no condition node under detection.".to_string()
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -1226,7 +1228,9 @@ mod tests {
|
||||
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec!["condition parse error has occured. An unusable character was found.".to_string()],
|
||||
vec![
|
||||
"A condition parse error has occured. An unusable character was found.".to_string(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1247,7 +1251,9 @@ mod tests {
|
||||
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec!["condition parse error has occured. expected ')'. but not found.".to_string()],
|
||||
vec![
|
||||
"A condition parse error has occured. ')' was expected but not found.".to_string(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1268,7 +1274,9 @@ mod tests {
|
||||
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec!["condition parse error has occured. expected '('. but not found.".to_string()],
|
||||
vec![
|
||||
"A condition parse error has occured. '(' was expected but not found.".to_string(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1289,7 +1297,9 @@ mod tests {
|
||||
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec!["condition parse error has occured. expected ')'. but not found.".to_string()],
|
||||
vec![
|
||||
"A condition parse error has occured. ')' was expected but not found.".to_string(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1308,7 +1318,7 @@ mod tests {
|
||||
output: 'Service name : %param1%¥nMessage : Event Log Service Stopped¥nResults: Selective event log manipulation may follow this event.'
|
||||
"#;
|
||||
|
||||
check_rule_parse_error(rule_str,vec!["condition parse error has occured. unknown error. maybe it\'s because there are multiple name of selection node.".to_string()]);
|
||||
check_rule_parse_error(rule_str,vec!["A condition parse error has occured. Unknown error. Maybe it is because there are multiple names of selection nodes.".to_string()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1329,7 +1339,7 @@ mod tests {
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec![
|
||||
"condition parse error has occured. illegal Logical Operator(and, or) was found."
|
||||
"A condition parse error has occured. An illegal logical operator(and, or) was found."
|
||||
.to_string(),
|
||||
],
|
||||
);
|
||||
@@ -1353,7 +1363,7 @@ mod tests {
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec![
|
||||
"condition parse error has occured. illegal Logical Operator(and, or) was found."
|
||||
"A condition parse error has occured. An illegal logical operator(and, or) was found."
|
||||
.to_string(),
|
||||
],
|
||||
);
|
||||
@@ -1374,7 +1384,7 @@ mod tests {
|
||||
output: 'Service name : %param1%¥nMessage : Event Log Service Stopped¥nResults: Selective event log manipulation may follow this event.'
|
||||
"#;
|
||||
|
||||
check_rule_parse_error(rule_str,vec!["condition parse error has occured. The use of logical operator(and, or) was wrong.".to_string()]);
|
||||
check_rule_parse_error(rule_str,vec!["A condition parse error has occured. The use of a logical operator(and, or) was wrong.".to_string()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1394,7 +1404,7 @@ mod tests {
|
||||
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec!["condition parse error has occured. illegal not was found.".to_string()],
|
||||
vec!["A condition parse error has occured. An illegal not was found.".to_string()],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1415,7 +1425,7 @@ mod tests {
|
||||
|
||||
check_rule_parse_error(
|
||||
rule_str,
|
||||
vec!["condition parse error has occured. not is continuous.".to_string()],
|
||||
vec!["A condition parse error has occured. Not is continuous.".to_string()],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ impl TimeFrameInfo {
|
||||
} else {
|
||||
AlertMessage::alert(
|
||||
&mut std::io::stderr().lock(),
|
||||
format!("timeframe is invalid.input value:{}", value),
|
||||
format!("Timeframe is invalid. Input value:{}", value),
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
@@ -207,7 +207,7 @@ pub fn get_sec_timeframe(timeframe: &Option<TimeFrameInfo>) -> Option<i64> {
|
||||
Err(err) => {
|
||||
AlertMessage::alert(
|
||||
&mut std::io::stderr().lock(),
|
||||
format!("timeframe num is invalid. timeframe.{}", err),
|
||||
format!("Timeframe number is invalid. timeframe.{}", err),
|
||||
)
|
||||
.ok();
|
||||
return Option::None;
|
||||
@@ -755,7 +755,7 @@ mod tests {
|
||||
let mut rule_node = create_rule("testpath".to_string(), test);
|
||||
let error_checker = rule_node.init();
|
||||
if error_checker.is_err() {
|
||||
assert!(false, "failed to init rulenode");
|
||||
assert!(false, "Failed to init rulenode");
|
||||
}
|
||||
for record_str in records_str {
|
||||
match serde_json::from_str(record_str) {
|
||||
@@ -769,7 +769,7 @@ mod tests {
|
||||
assert_eq!(result, &true);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ impl LeafMatcher for MinlengthMatcher {
|
||||
let min_length = select_value.as_i64();
|
||||
if min_length.is_none() {
|
||||
let errmsg = format!(
|
||||
"min_length value should be Integer. [key:{}]",
|
||||
"min_length value should be an integer. [key:{}]",
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
return Result::Err(vec![errmsg]);
|
||||
@@ -99,7 +99,7 @@ impl LeafMatcher for RegexesFileMatcher {
|
||||
};
|
||||
if value.is_none() {
|
||||
let errmsg = format!(
|
||||
"regexes value should be String. [key:{}]",
|
||||
"regexes value should be a string. [key:{}]",
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
return Result::Err(vec![errmsg]);
|
||||
@@ -158,7 +158,7 @@ impl LeafMatcher for AllowlistFileMatcher {
|
||||
};
|
||||
if value.is_none() {
|
||||
let errmsg = format!(
|
||||
"allowlist value should be String. [key:{}]",
|
||||
"allowlist value should be a string. [key:{}]",
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
return Result::Err(vec![errmsg]);
|
||||
@@ -253,7 +253,7 @@ impl LeafMatcher for DefaultMatcher {
|
||||
};
|
||||
if yaml_value.is_none() {
|
||||
let errmsg = format!(
|
||||
"unknown error occured. [key:{}]",
|
||||
"An unknown error occured. [key:{}]",
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
return Result::Err(vec![errmsg]);
|
||||
@@ -275,7 +275,7 @@ impl LeafMatcher for DefaultMatcher {
|
||||
};
|
||||
if pipe_element.is_none() {
|
||||
let errmsg = format!(
|
||||
"unknown pipe element was specified. key:{}",
|
||||
"An unknown pipe element was specified. key:{}",
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
return Result::Err(vec![errmsg]);
|
||||
@@ -286,7 +286,7 @@ impl LeafMatcher for DefaultMatcher {
|
||||
if self.pipes.len() >= 2 {
|
||||
// 現状では複数のパイプは対応していない
|
||||
let errmsg = format!(
|
||||
"multiple pipe element can't be used. key:{}",
|
||||
"Multiple pipe elements cannot be used. key:{}",
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
return Result::Err(vec![errmsg]);
|
||||
@@ -309,7 +309,7 @@ impl LeafMatcher for DefaultMatcher {
|
||||
let re_result = Regex::new(&pattern);
|
||||
if re_result.is_err() {
|
||||
let errmsg = format!(
|
||||
"cannot parse regex. [regex:{}, key:{}]",
|
||||
"Cannot parse regex. [regex:{}, key:{}]",
|
||||
pattern,
|
||||
utils::concat_selection_key(key_list)
|
||||
);
|
||||
@@ -779,7 +779,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -846,7 +846,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -880,7 +880,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -913,7 +913,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -946,7 +946,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -980,7 +980,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1048,7 +1048,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1082,7 +1082,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1186,7 +1186,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1223,7 +1223,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1259,7 +1259,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1304,7 +1304,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1349,7 +1349,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1394,7 +1394,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1439,7 +1439,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1484,7 +1484,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1529,7 +1529,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1562,7 +1562,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1595,7 +1595,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1628,7 +1628,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1721,7 +1721,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1756,7 +1756,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1791,7 +1791,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1826,7 +1826,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ impl DetectionNode {
|
||||
let mut keys = self.name_to_selection.keys().clone();
|
||||
if keys.len() >= 2 {
|
||||
return Result::Err(vec![
|
||||
"There are no condition node under detection.".to_string()
|
||||
"There is no condition node under detection.".to_string()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ impl DetectionNode {
|
||||
fn parse_name_to_selection(&mut self, detection_yaml: &Yaml) -> Result<(), Vec<String>> {
|
||||
let detection_hash = detection_yaml.as_hash();
|
||||
if detection_hash.is_none() {
|
||||
return Result::Err(vec!["not found detection node".to_string()]);
|
||||
return Result::Err(vec!["Detection node was not found.".to_string()]);
|
||||
}
|
||||
|
||||
// selectionをパースする。
|
||||
@@ -229,7 +229,7 @@ impl DetectionNode {
|
||||
// selectionノードが無いのはエラー
|
||||
if self.name_to_selection.len() == 0 {
|
||||
return Result::Err(vec![
|
||||
"There are no selection node under detection.".to_string()
|
||||
"There is no selection node under detection.".to_string()
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,7 +393,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -426,7 +426,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,7 +512,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -574,7 +574,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -643,7 +643,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -690,7 +690,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -738,7 +738,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -805,7 +805,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -872,7 +872,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -921,7 +921,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -943,7 +943,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
rule_node.init(),
|
||||
Err(vec![
|
||||
"unknown pipe element was specified. key:detection -> selection -> Channel|failed"
|
||||
"An unknown pipe element was specified. key:detection -> selection -> Channel|failed"
|
||||
.to_string()
|
||||
])
|
||||
);
|
||||
@@ -962,7 +962,7 @@ mod tests {
|
||||
|
||||
assert_eq!(
|
||||
rule_node.init(),
|
||||
Err(vec!["not found detection node".to_string()])
|
||||
Err(vec!["Detection node was not found.".to_string()])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -997,7 +997,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
Err(_rec) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ impl SelectionNode for LeafSelectionNode {
|
||||
|
||||
if self.select_value.is_badvalue() {
|
||||
return Result::Err(vec![format!(
|
||||
"Cannot parse yaml file. key:{}",
|
||||
"Cannot parse yml file. key:{}",
|
||||
utils::concat_selection_key(&match_key_list)
|
||||
)]);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -482,7 +482,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -517,7 +517,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -552,7 +552,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), true);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,7 +587,7 @@ mod tests {
|
||||
assert_eq!(rule_node.select(&"testpath".to_owned(), &recinfo), false);
|
||||
}
|
||||
Err(_) => {
|
||||
assert!(false, "failed to parse json record.");
|
||||
assert!(false, "Failed to parse json record.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user