mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 12:37:45 +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:
|
||||
- label: build
|
||||
command:
|
||||
- nix3 build
|
||||
- label: build
|
||||
command:
|
||||
- nix3 build
|
||||
|
||||
- label: cache
|
||||
if: build.branch == "main"
|
||||
command:
|
||||
- echo +++
|
||||
- nix3 build
|
||||
- cachix push alejandra result
|
||||
- label: cache
|
||||
if: build.branch == "main"
|
||||
command:
|
||||
- echo +++
|
||||
- nix3 build
|
||||
- cachix push alejandra result
|
||||
|
||||
- nix3 develop --profile develop --command true
|
||||
- cachix push alejandra develop
|
||||
- nix3 develop --profile develop --command true
|
||||
- cachix push alejandra develop
|
||||
|
||||
- label: coverage
|
||||
if: build.branch == "main"
|
||||
command:
|
||||
- echo +++
|
||||
- direnv allow
|
||||
- eval "$(direnv export bash)"
|
||||
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
|
||||
- label: coverage
|
||||
if: build.branch == "main"
|
||||
command:
|
||||
- echo +++
|
||||
- direnv allow
|
||||
- eval "$(direnv export bash)"
|
||||
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
|
||||
|
||||
- label: diff
|
||||
if: build.branch != "main"
|
||||
artifacts:
|
||||
- closure-before.txt
|
||||
- closure-after.txt
|
||||
- closure-before-vs-after.patch.txt
|
||||
- formatting-before-vs-after.patch.txt
|
||||
- formatting-after.patch.txt
|
||||
command:
|
||||
- git config --global user.email ci@cd
|
||||
- git config --global user.name CI/CD
|
||||
- git clone --depth 1 https://github.com/nixos/nixpkgs
|
||||
- label: diff
|
||||
if: build.branch != "main"
|
||||
artifacts:
|
||||
- closure-before.txt
|
||||
- closure-after.txt
|
||||
- closure-before-vs-after.patch.txt
|
||||
- formatting-before-vs-after.patch.txt
|
||||
- formatting-after.patch.txt
|
||||
command:
|
||||
- git config --global user.email ci@cd
|
||||
- git config --global user.name CI/CD
|
||||
- git clone --depth 1 https://github.com/nixos/nixpkgs
|
||||
|
||||
- echo --- Formatting @ before
|
||||
- nix3 run github:kamadorueda/alejandra -- nixpkgs 2>/dev/null
|
||||
- git -C nixpkgs add .
|
||||
- git -C nixpkgs commit -m formatting-before -q
|
||||
- git -C nixpkgs branch formatting-before
|
||||
- git -C nixpkgs reset --hard master~1
|
||||
- echo --- Formatting @ before
|
||||
- nix3 run github:kamadorueda/alejandra -- nixpkgs 2>/dev/null
|
||||
- git -C nixpkgs add .
|
||||
- git -C nixpkgs commit -m formatting-before -q
|
||||
- git -C nixpkgs branch formatting-before
|
||||
- git -C nixpkgs reset --hard master~1
|
||||
|
||||
- echo --- Closure @ before
|
||||
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-before.txt
|
||||
- echo --- Closure @ before
|
||||
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-before.txt
|
||||
|
||||
- echo --- Formatting @ after
|
||||
- nix3 run . -- nixpkgs 2>/dev/null
|
||||
- git -C nixpkgs diff formatting-before > formatting-before-vs-after.patch.txt
|
||||
- git -C nixpkgs diff > formatting-after.patch.txt
|
||||
- echo --- Formatting @ after
|
||||
- nix3 run . -- nixpkgs 2>/dev/null
|
||||
- git -C nixpkgs diff formatting-before > formatting-before-vs-after.patch.txt
|
||||
- git -C nixpkgs diff > formatting-after.patch.txt
|
||||
|
||||
- echo --- Closure @ after
|
||||
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-after.txt
|
||||
- echo --- Closure @ after
|
||||
- nix-env --query --available --attr-path --drv-path --file nixpkgs --xml > closure-after.txt
|
||||
|
||||
- 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 --shortstat || true
|
||||
- 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 --shortstat || true
|
||||
|
||||
- echo +++ Derivations count
|
||||
- grep -c drvPath= closure-after.txt
|
||||
- echo +++ Derivations count
|
||||
- grep -c drvPath= closure-after.txt
|
||||
|
||||
- label: flake check
|
||||
command:
|
||||
- echo +++
|
||||
- nix3 flake check
|
||||
- label: flake check
|
||||
command:
|
||||
- echo +++
|
||||
- nix3 flake check
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
version =
|
||||
let
|
||||
commit = inputs.self.shortRev or "dirty";
|
||||
date =
|
||||
inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
|
||||
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
|
||||
in
|
||||
"${builtins.substring 0 8 date}_${commit}";
|
||||
src = inputs.self.sourceInfo;
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -24,13 +26,17 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
@ -107,10 +113,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// b
|
||||
|
@ -125,13 +134,17 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
|
|
@ -21,6 +21,13 @@ rec /**/ {
|
|||
, ...
|
||||
}: { };
|
||||
|
||||
a
|
||||
/*b*/
|
||||
=
|
||||
/*c*/
|
||||
1
|
||||
/*d*/
|
||||
;
|
||||
|
||||
p = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { }
|
||||
a;
|
||||
|
|
|
@ -101,6 +101,20 @@ rec
|
|||
}:
|
||||
{ };
|
||||
|
||||
a
|
||||
/*
|
||||
b
|
||||
*/
|
||||
=
|
||||
/*
|
||||
c
|
||||
*/
|
||||
1
|
||||
/*
|
||||
d
|
||||
*/
|
||||
;
|
||||
|
||||
p =
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue