Skip to content

Commit

Permalink
Include all ident parts in keys (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Feb 18, 2025
1 parent a871185 commit 21d7751
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions common/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,14 @@ pub fn collapse_sub_tables(tables: &mut Tables, name: &str) {
let child_node = child.as_node().unwrap();
for mut entry in child_node.children_with_tokens() {
if entry.kind() == KEY {
let mut key_parts = vec![String::from(sub_name)];
for array_entry_value in entry.as_node().unwrap().children_with_tokens() {
if array_entry_value.kind() == IDENT {
let txt = load_text(array_entry_value.as_token().unwrap().text(), IDENT);
entry = make_key(format!("{sub_name}.{txt}").as_str());
break;
key_parts.push(txt);
}
}
entry = make_key(&key_parts.join("."));
}
to_insert.push(entry);
}
Expand Down
1 change: 1 addition & 0 deletions pyproject-fmt/rust/src/data/ruff-order.expected.toml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ lint.flake8-self.extend-ignore-names = [
"ALPHA",
"Bar",
]
lint.flake8-tidy-imports.banned-api."foo".msg = "Use bar instead"
lint.flake8-tidy-imports.banned-module-level-imports = [
"ALPHA",
"Bar",
Expand Down
2 changes: 2 additions & 0 deletions pyproject-fmt/rust/src/data/ruff-order.start.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ docstring-quotes = 'single'
extend-ignore-names = ['Bar', 'ALPHA']
[tool.ruff.lint.flake8-tidy-imports]
banned-module-level-imports = ['Bar', 'ALPHA']
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"foo".msg = "Use bar instead"
[tool.ruff.lint.flake8-type-checking]
exempt-modules = ['Bar', 'ALPHA']
[tool.ruff.lint.flake8-unused-arguments]
Expand Down

0 comments on commit 21d7751

Please sign in to comment.