mirror of
https://github.com/RGBCube/alejandra
synced 2025-08-01 04:57:44 +00:00
Merge pull request #51 from kamadorueda/kamadorueda
feat: key-value without max-width
This commit is contained in:
commit
f179b2e855
5 changed files with 104 additions and 71 deletions
106
buildkite.yaml
106
buildkite.yaml
|
@ -1,65 +1,65 @@
|
||||||
steps:
|
steps:
|
||||||
- label: build
|
- label: build
|
||||||
command:
|
command:
|
||||||
- nix3 build
|
- nix3 build
|
||||||
|
|
||||||
- label: cache
|
- label: cache
|
||||||
if: build.branch == "main"
|
if: build.branch == "main"
|
||||||
command:
|
command:
|
||||||
- echo +++
|
- echo +++
|
||||||
- nix3 build
|
- nix3 build
|
||||||
- cachix push alejandra result
|
- cachix push alejandra result
|
||||||
|
|
||||||
- nix3 develop --profile develop --command true
|
- nix3 develop --profile develop --command true
|
||||||
- cachix push alejandra develop
|
- cachix push alejandra develop
|
||||||
|
|
||||||
- label: coverage
|
- label: coverage
|
||||||
if: build.branch == "main"
|
if: build.branch == "main"
|
||||||
command:
|
command:
|
||||||
- echo +++
|
- echo +++
|
||||||
- direnv allow
|
- direnv allow
|
||||||
- eval "$(direnv export bash)"
|
- eval "$(direnv export bash)"
|
||||||
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
|
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
|
||||||
|
|
||||||
- label: diff
|
- label: diff
|
||||||
if: build.branch != "main"
|
if: build.branch != "main"
|
||||||
artifacts:
|
artifacts:
|
||||||
- closure-before.txt
|
- closure-before.txt
|
||||||
- closure-after.txt
|
- closure-after.txt
|
||||||
- closure-before-vs-after.patch.txt
|
- closure-before-vs-after.patch.txt
|
||||||
- formatting-before-vs-after.patch.txt
|
- formatting-before-vs-after.patch.txt
|
||||||
- formatting-after.patch.txt
|
- formatting-after.patch.txt
|
||||||
command:
|
command:
|
||||||
- git config --global user.email ci@cd
|
- git config --global user.email ci@cd
|
||||||
- git config --global user.name CI/CD
|
- git config --global user.name CI/CD
|
||||||
- git clone --depth 1 https://github.com/nixos/nixpkgs
|
- git clone --depth 1 https://github.com/nixos/nixpkgs
|
||||||
|
|
||||||
- echo --- Formatting @ before
|
- echo --- Formatting @ before
|
||||||
- nix3 run github:kamadorueda/alejandra -- nixpkgs 2>/dev/null
|
- nix3 run github:kamadorueda/alejandra -- nixpkgs 2>/dev/null
|
||||||
- git -C nixpkgs add .
|
- git -C nixpkgs add .
|
||||||
- git -C nixpkgs commit -m formatting-before -q
|
- git -C nixpkgs commit -m formatting-before -q
|
||||||
- git -C nixpkgs branch formatting-before
|
- git -C nixpkgs branch formatting-before
|
||||||
- git -C nixpkgs reset --hard master~1
|
- git -C nixpkgs reset --hard master~1
|
||||||
|
|
||||||
- echo --- Closure @ before
|
- echo --- Closure @ before
|
||||||
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-before.txt
|
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-before.txt
|
||||||
|
|
||||||
- echo --- Formatting @ after
|
- echo --- Formatting @ after
|
||||||
- nix3 run . -- nixpkgs 2>/dev/null
|
- nix3 run . -- nixpkgs 2>/dev/null
|
||||||
- git -C nixpkgs diff formatting-before > formatting-before-vs-after.patch.txt
|
- git -C nixpkgs diff formatting-before > formatting-before-vs-after.patch.txt
|
||||||
- git -C nixpkgs diff > formatting-after.patch.txt
|
- git -C nixpkgs diff > formatting-after.patch.txt
|
||||||
|
|
||||||
- echo --- Closure @ after
|
- echo --- Closure @ after
|
||||||
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-after.txt
|
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-after.txt
|
||||||
|
|
||||||
- echo +++ Closure diff
|
- echo +++ Closure diff
|
||||||
- git diff --no-index closure-before.txt closure-after.txt > closure-before-vs-after.patch.txt || true
|
- git diff --no-index closure-before.txt closure-after.txt > closure-before-vs-after.patch.txt || true
|
||||||
- git diff --no-index closure-before.txt closure-after.txt --shortstat || true
|
- git diff --no-index closure-before.txt closure-after.txt --shortstat || true
|
||||||
|
|
||||||
- echo +++ Derivations count
|
- echo +++ Derivations count
|
||||||
- grep -c drvPath= closure-after.txt
|
- grep -c drvPath= closure-after.txt
|
||||||
|
|
||||||
- label: flake check
|
- label: flake check
|
||||||
command:
|
command:
|
||||||
- echo +++
|
- echo +++
|
||||||
- nix3 flake check
|
- nix3 flake check
|
||||||
|
|
|
@ -33,8 +33,7 @@
|
||||||
version =
|
version =
|
||||||
let
|
let
|
||||||
commit = inputs.self.shortRev or "dirty";
|
commit = inputs.self.shortRev or "dirty";
|
||||||
date =
|
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
|
||||||
inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
|
|
||||||
in
|
in
|
||||||
"${builtins.substring 0 8 date}_${commit}";
|
"${builtins.substring 0 8 date}_${commit}";
|
||||||
src = inputs.self.sourceInfo;
|
src = inputs.self.sourceInfo;
|
||||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
||||||
) -> std::collections::LinkedList<crate::builder::Step> {
|
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||||
let mut steps = std::collections::LinkedList::new();
|
let mut steps = std::collections::LinkedList::new();
|
||||||
|
|
||||||
let mut children = crate::children::Children::new(build_ctx, node);
|
let mut children = crate::children::Children::new_with_configuration(
|
||||||
|
build_ctx, node, true,
|
||||||
|
);
|
||||||
|
|
||||||
let layout = if children.has_comments() {
|
let layout = if children.has_comments() || children.has_newlines() {
|
||||||
&crate::config::Layout::Tall
|
&crate::config::Layout::Tall
|
||||||
} else {
|
} else {
|
||||||
build_ctx.config.layout()
|
build_ctx.config.layout()
|
||||||
|
@ -24,13 +26,17 @@ pub fn rule(
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**/
|
// /**/
|
||||||
children.drain_comments(|text| {
|
children.drain_comments_and_newlines(|element| match element {
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
steps.push_back(crate::builder::Step::Comment(text));
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
|
}
|
||||||
|
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
if let rnix::SyntaxKind::TOKEN_COMMENT =
|
if let rnix::SyntaxKind::TOKEN_COMMENT
|
||||||
|
| rnix::SyntaxKind::TOKEN_WHITESPACE =
|
||||||
children.peek_prev().unwrap().element.kind()
|
children.peek_prev().unwrap().element.kind()
|
||||||
{
|
{
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
|
@ -107,10 +113,13 @@ pub fn rule(
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**/
|
// /**/
|
||||||
children.drain_comments(|text| {
|
children.drain_comments_and_newlines(|element| match element {
|
||||||
steps.push_back(crate::builder::Step::Comment(text));
|
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
|
}
|
||||||
|
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// b
|
// b
|
||||||
|
@ -125,13 +134,17 @@ pub fn rule(
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**/
|
// /**/
|
||||||
children.drain_comments(|text| {
|
children.drain_comments_and_newlines(|element| match element {
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||||
steps.push_back(crate::builder::Step::Pad);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
steps.push_back(crate::builder::Step::Comment(text));
|
steps.push_back(crate::builder::Step::Pad);
|
||||||
|
steps.push_back(crate::builder::Step::Comment(text));
|
||||||
|
}
|
||||||
|
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||||
});
|
});
|
||||||
|
|
||||||
if let rnix::SyntaxKind::TOKEN_COMMENT =
|
if let rnix::SyntaxKind::TOKEN_COMMENT
|
||||||
|
| rnix::SyntaxKind::TOKEN_WHITESPACE =
|
||||||
children.peek_prev().unwrap().element.kind()
|
children.peek_prev().unwrap().element.kind()
|
||||||
{
|
{
|
||||||
steps.push_back(crate::builder::Step::NewLine);
|
steps.push_back(crate::builder::Step::NewLine);
|
||||||
|
|
|
@ -21,6 +21,13 @@ rec /**/ {
|
||||||
, ...
|
, ...
|
||||||
}: { };
|
}: { };
|
||||||
|
|
||||||
|
a
|
||||||
|
/*b*/
|
||||||
|
=
|
||||||
|
/*c*/
|
||||||
|
1
|
||||||
|
/*d*/
|
||||||
|
;
|
||||||
|
|
||||||
p = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { }
|
p = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { }
|
||||||
a;
|
a;
|
||||||
|
|
|
@ -101,6 +101,20 @@ rec
|
||||||
}:
|
}:
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
|
a
|
||||||
|
/*
|
||||||
|
b
|
||||||
|
*/
|
||||||
|
=
|
||||||
|
/*
|
||||||
|
c
|
||||||
|
*/
|
||||||
|
1
|
||||||
|
/*
|
||||||
|
d
|
||||||
|
*/
|
||||||
|
;
|
||||||
|
|
||||||
p =
|
p =
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a;
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue