mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 12:37:45 +00:00
feat: pat entry coverage
This commit is contained in:
parent
58903f5b98
commit
04ac8d46b1
4 changed files with 35 additions and 13 deletions
11
README.md
11
README.md
|
@ -65,6 +65,8 @@ Let's get Alejandra on our systems:
|
||||||
and formats [Nixpkgs](https://github.com/NixOS/nixpkgs)
|
and formats [Nixpkgs](https://github.com/NixOS/nixpkgs)
|
||||||
in under 1 minute.
|
in under 1 minute.
|
||||||
|
|
||||||
|
That's 55000 lines of Nix code per second.
|
||||||
|
|
||||||
- ✔️ **Highly tested**
|
- ✔️ **Highly tested**
|
||||||
|
|
||||||
Coverage currently > 80%,
|
Coverage currently > 80%,
|
||||||
|
@ -75,6 +77,11 @@ Let's get Alejandra on our systems:
|
||||||
All elements in the Nix grammar have a rule,
|
All elements in the Nix grammar have a rule,
|
||||||
so there won't be portions of code unformatted.
|
so there won't be portions of code unformatted.
|
||||||
|
|
||||||
|
- ✔️ **Tolerant to syntax errors**
|
||||||
|
|
||||||
|
We'll format the portions of a file that is valid Nix code,
|
||||||
|
and leave as-is the portions that contain syntax errors.
|
||||||
|
|
||||||
- ✔️ **Reproducible**
|
- ✔️ **Reproducible**
|
||||||
|
|
||||||
Formatting many times yields the same results.
|
Formatting many times yields the same results.
|
||||||
|
@ -84,8 +91,8 @@ Let's get Alejandra on our systems:
|
||||||
Beauty is subjective, right?
|
Beauty is subjective, right?
|
||||||
|
|
||||||
Yet there are a few improvements to implement like:
|
Yet there are a few improvements to implement like:
|
||||||
- Multiline strings indentation `'' ... ''`.
|
- Multiline strings indentation is missing `'' ... ''`.
|
||||||
- Multiline comments indentation `/* ... */`.
|
- Multiline comments indentation is bugged `/* ... */`.
|
||||||
- And many more as community feedback drives.
|
- And many more as community feedback drives.
|
||||||
|
|
||||||
Style is negotiable at this moment.
|
Style is negotiable at this moment.
|
||||||
|
|
|
@ -16,17 +16,7 @@ pub fn rule(
|
||||||
let child = children.get_next().unwrap();
|
let child = children.get_next().unwrap();
|
||||||
match layout {
|
match layout {
|
||||||
crate::config::Layout::Tall => {
|
crate::config::Layout::Tall => {
|
||||||
match child.element.kind() {
|
steps.push_back(crate::builder::Step::FormatWider(child.element));
|
||||||
rnix::SyntaxKind::NODE_OR_DEFAULT => {
|
|
||||||
steps
|
|
||||||
.push_back(crate::builder::Step::Format(child.element));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
steps.push_back(crate::builder::Step::FormatWider(
|
|
||||||
child.element,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps.push_back(crate::builder::Step::Indent);
|
steps.push_back(crate::builder::Step::Indent);
|
||||||
}
|
}
|
||||||
crate::config::Layout::Wide => {
|
crate::config::Layout::Wide => {
|
||||||
|
|
|
@ -70,4 +70,7 @@
|
||||||
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , ... /*h*/ }: _)
|
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , ... /*h*/ }: _)
|
||||||
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , /*g*/ ... }: _)
|
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , /*g*/ ... }: _)
|
||||||
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , /*g*/ ... /*h*/ }: _)
|
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , /*g*/ ... /*h*/ }: _)
|
||||||
|
|
||||||
|
({ a ? null }: _)
|
||||||
|
({ /*a*/ b /*a*/ ? /*a*/ null /*c*/ , /*d*/ e /*a*/ ? /*a*/ null /*f*/ , /*g*/ ... /*h*/ }: _)
|
||||||
]
|
]
|
||||||
|
|
|
@ -659,4 +659,26 @@
|
||||||
}:
|
}:
|
||||||
_
|
_
|
||||||
)
|
)
|
||||||
|
( { a ? null }: _ )
|
||||||
|
(
|
||||||
|
{ /*a*/
|
||||||
|
b
|
||||||
|
/*a*/
|
||||||
|
?
|
||||||
|
/*a*/
|
||||||
|
null
|
||||||
|
/*c*/
|
||||||
|
, /*d*/
|
||||||
|
e
|
||||||
|
/*a*/
|
||||||
|
?
|
||||||
|
/*a*/
|
||||||
|
null
|
||||||
|
/*f*/
|
||||||
|
, /*g*/
|
||||||
|
...
|
||||||
|
/*h*/
|
||||||
|
}:
|
||||||
|
_
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue