Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/core/src/models/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ impl std::str::FromStr for PiranhaLanguage {
let ruby_rules: Rules = parse_toml(include_str!("../cleanup_rules/ruby/rules.toml"));
let ruby_edges: Edges = parse_toml(include_str!("../cleanup_rules/ruby/edges.toml"));
Ok(PiranhaLanguage {
extension: "rs".to_string(),
extension: "rb".to_string(),
supported_language: SupportedLanguage::Ruby,
language: tree_sitter_ruby::language(),
scopes: parse_toml::<ScopeConfig>(include_str!(
"../cleanup_rules/ruby/scope_config.toml"
))
.scopes()
.to_vec(),
comment_nodes: vec![],
comment_nodes: vec!["comment".to_string()],
rules: Some(ruby_rules),
edges: Some(ruby_edges),
})
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mod test_piranha_scala;

mod test_piranha_thrift;

mod test_piranha_ruby;
mod test_piranha_scm;
mod test_piranha_strings;
mod test_piranha_yaml;
Expand Down
32 changes: 32 additions & 0 deletions crates/core/src/tests/test_piranha_ruby.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright (c) 2023 Uber Technologies, Inc.

<p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
<p>http://www.apache.org/licenses/LICENSE-2.0

<p>Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
limitations under the License.
*/

use crate::models::default_configs::RUBY;

use super::create_rewrite_tests;

create_rewrite_tests! {
RUBY,
test_replace_empty_if_unless_statement: "replace_empty_if_or_unless_statement", 1;
test_replace_ternary_operator: "replace_ternary_operator", 1;
test_replace_if_statement: "replace_if_statement", 3;
test_replace_unless_statement: "replace_unless_statement", 3;
test_boolean_cleanup: "simplify_boolean_expressions", 1;
test_simplify_rspec_block_expressions: "simplify_rspec_block_expressions", 1;
test_simplify_if_lambda_conditional_statements: "simplify_if_lambda_conditional_statements", 1;
test_simplify_unless_lambda_conditional_statements: "simplify_unless_lambda_conditional_statements", 1;
test_simplify_if_proc_conditional_statements: "simplify_if_proc_conditional_statements", 1;
test_simplify_unless_proc_conditional_statements: "simplify_unless_proc_conditional_statements", 1;
test_delete_lines_after_return: "delete_lines_after_return", 1;
simplify_variable_assigned_flag_check: "simplify_variable_assigned_flag_check", 1;
}