1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

feat: pat entry coverage

This commit is contained in:
Kevin Amado 2022-01-26 21:25:03 -05:00
parent 58903f5b98
commit 04ac8d46b1
No known key found for this signature in database
GPG key ID: FFF341057F503148
4 changed files with 35 additions and 13 deletions

View file

@ -65,6 +65,8 @@ Let's get Alejandra on our systems:
and formats [Nixpkgs](https://github.com/NixOS/nixpkgs)
in under 1 minute.
That's 55000 lines of Nix code per second.
- ✔️ **Highly tested**
Coverage currently > 80%,
@ -75,6 +77,11 @@ Let's get Alejandra on our systems:
All elements in the Nix grammar have a rule,
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**
Formatting many times yields the same results.
@ -84,8 +91,8 @@ Let's get Alejandra on our systems:
Beauty is subjective, right?
Yet there are a few improvements to implement like:
- Multiline strings indentation `'' ... ''`.
- Multiline comments indentation `/* ... */`.
- Multiline strings indentation is missing `'' ... ''`.
- Multiline comments indentation is bugged `/* ... */`.
- And many more as community feedback drives.
Style is negotiable at this moment.

View file

@ -16,17 +16,7 @@ pub fn rule(
let child = children.get_next().unwrap();
match layout {
crate::config::Layout::Tall => {
match child.element.kind() {
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::FormatWider(child.element));
steps.push_back(crate::builder::Step::Indent);
}
crate::config::Layout::Wide => {

View file

@ -70,4 +70,7 @@
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , ... /*h*/ }: _)
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , /*g*/ ... }: _)
({ /*a*/ b /*c*/ , /*d*/ e /*f*/ , /*g*/ ... /*h*/ }: _)
({ a ? null }: _)
({ /*a*/ b /*a*/ ? /*a*/ null /*c*/ , /*d*/ e /*a*/ ? /*a*/ null /*f*/ , /*g*/ ... /*h*/ }: _)
]

View file

@ -659,4 +659,26 @@
}:
_
)
( { a ? null }: _ )
(
{ /*a*/
b
/*a*/
?
/*a*/
null
/*c*/
, /*d*/
e
/*a*/
?
/*a*/
null
/*f*/
, /*g*/
...
/*h*/
}:
_
)
]